Git is a very popular distributed revision control system with an emphasis on speed. Recently for my projects I need to setup up a private Git Setup on Webfaction Server. So here is the way to Install and start using Git on Webfaction.
How to Install Git on Webfaction
- Log into your Webfaction Control Panel
- Navigate to Domains/Websites » Applications
- Click Add New
- Enter git as the application name in the Name field
- Select git from the App category menu
- Enter a password for the default user in the Extra Info field
- Click the Create button
The Git application provides a subdirectory, bin, which contains the Git executables. It also provides a subdirectory, repos, to store your Git repositories. repos/proj.git has been created automatically as an example.
Later you'll have to create a Website (Domain/Website -> Website, in Control Panel), which maps this newly created Git application to some subdomain. For further explanation i'll assume this domain to be "git.domain.com"
If you want you can delete existing proj.git by simply deleting this directory.
rm -r ~/webapps/git/repos/proj.git
Create a new Git Repository
- Open an SSH session to your webfaction account:
ssh username@username.webfactional.com cd ~/webapps/git/./bin/git init --bare ./repos/reponame.git
This will create a new repository, where reponameis the name of your repositorycd repos/repo.git../../bin/git config http.receivepack true
This will enable HTTP push to repository
Pushing local code to this repository
cd /path/to/your/local/repository/git initIf it’s not already under version controlgit add .git commit -a -m 'Initial commit.'- If you want to use SSH mode then
git remote add origin ssh://username@git.domain.com/~/webapps/git/repos/reponame.git
For HTTP Mode
git remote add origin http://username@git.domain.com/reponame.git git push origin mastergit push
Final Command should give you Everything up-to-date message.
Introduce Yourself to Git Server
It is a good idea to introduce yourself to git with your name and public email address before doing any operation. The easiest way to do so is:
git config --global user.name "Nitin Hayaran"
git config --global user.email you@yourdomain.example.com
Troubleshooting
On giving git push origin master command git may throw error error: RPC failed; result=22, HTTP code = 411. It will show you message like this:
Compressing objects: 100% (792/792), done.
error: RPC failed; result=22, HTTP code = 411
Writing objects: 100% (1148/1148), 18.79 MiB | 13.81 MiB/s, done.
Total 1148 (delta 356), reused 944 (delta 214)
This error comes when either your code size is big, or there is any file with big size. To solve this problem you need to increase buffer size in Git configuration.
git config http.postBuffer 524288000
Clone Your Repository Somewhere New
With SSH Mode Setup
git clone username@git.domain.com:webapps/git/repos/reponame.git
For HTTP Push Mode
git clone http://username@git.domain.com/reponame.git

Hi.. lemme know ur mail id.. will stay in touch..