Hosting a git repo yourself is a very simple exercise. If you don’t need (or don’t want to pay for) features offered by github, you can setup your server to host your git repo. All you need is a server with ssh access. Here are the steps that you need to follow
Login to your server
ssh tom@example.com
tom@example.com$ mkdir my_repo.git
tom@example.com$ cd my_repo.git
tom@example.com$ git init
On you local machine, where you have your code
$ cd my_code # cd to your code
$ git init
$ git add . # Adds everything. Use .gitignore to ignore some files
$ git remote add origin tom@example.com:my_repo.git
$ git push origin master
Now you can clone tom@example.com:my_repo.git on any number of machines. To not share password, put your public keys on tom@example.com
This approach gives you a basic git setup with ssh access (no http access). These steps should work on shared hosting too (as long as you have git available)
Hi Prateek,
I think you probably need this on the remote server:
git config –bool core.bare true
Regards,
Swanand
Link | February 16th, 2011 at 8:10 am
i.e. while running for the first time
Link | February 16th, 2011 at 8:17 am
Hmm .. not sure … I don’t think I needed this
Nevertheless, thanks for the comment. It may save someone some trouble
Link | February 17th, 2011 at 10:08 am