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:Â
./bin/git init --bare ./repos/reponame.git
This will create a new repository, whereÂ reponameis the name of your repository
../../bin/git config http.receivepack true
This will enable HTTP push to repository
Pushing local code to this repository
git initIf itâ€™s not already under version control
git add .
git commit -a -m 'Initial commit.'
- If you want to use SSH mode then
git remote add origin ssh://email@example.com/~/webapps/git/repos/reponame.git
For HTTP Mode
git remote add origin http://firstname.lastname@example.org/reponame.git
git push origin master
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 email@example.com
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 firstname.lastname@example.org:webapps/git/repos/reponame.git
For HTTP Push Mode
git clone http://email@example.com/reponame.git