The intended work-flow is to keep committing local changes while you work on you r website and when you are happy with it you push to a secure git repo. Then make your webapp pull from the central secure repo.
$ shh username@username.webfaction.com
$ cd ./bin
#//Check out the latest version, currently it is 1.7.0.2
$ wget http://kernel.org/pub/software/scm/git/git-1.7.0.2.tar.gz
$ tar zxf git-1.7.0.2.tar.gz
$ cd git-1.7.0.2
$ ./configure --prefix=$HOME && make && make install
#//Clean up the original stuff leaving the compiled binaries in ~/bin
$ cd ~/bin
$ rm -rf git-1.7.0.2*
#//This bring the total from 80MBs down to 14MBs
$ mkdir ~/repo/projectname.git
$ cd ~/repo/projectname.git
$ git --bare init
Now local stuff to connect it
$ cd /path/to/your/local/repository/
$ git init #Assumes it is not already a git repo
$ touch README.md
$ git add README.md
$ git commit -a -m '*Added README.md'
#//Now try to connect to server, will request your ssh password or not if you have key based ssh auth setup
$ git push ssh://user@user.webfactional.com/~/repo/projectname.git
You will see this error
$ bash: git-receive-pack: command not found
$ fatal: The remote end hung up unexpectedly
This is because of an oddity in the way the .bash_profile and .bashrc are setup.
ssh only loads the .bash_profile.
.bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
## MOVE THIS TO .bashrc THENthey Will both be the same
# User specific environment and startup programs
#PATH=$PATH:$HOME/bin
#export PATH
.bashrc
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
export PATH
# User specific aliases and functions
NB: The following may be added so you can use the 'git push' shortcut (it actually runs git push origin master).
$ git remote add origin ssh://user@server-ip-or-address/~/repo/projectname.git
$ git push origin master
$ git push
Based on http://devioustree.co.uk/2009/07/23/setting-up-git-on-webfaction/
and http://docs.webfaction.com/software/git.html
1 comment:
I am using some other tool to carry out the process but it is very slow. I will try this one also.
Post a Comment