Setting up a git repo on a 1and1 server over ssh

Posted in June 2012 by under sysadmin

If you need a centralised place to set up a git repository you can't really do better than using github. However if you are storing files in git that you don't want to be publicly available you will have to pay to use private repos on github.

It is fairly simple to set up your own git repositories on a server, so that you can have a centralised location without publishing files to the world. 1and1 allow you to set up git repositories over ssh. The pros and cons of doing this are explained in the git Documentation.

To get started create a bare repository ( in this case "project1" ) on the 1and1 server

git init --bare project1.git

Then on your localhost you can clone this repository using

git clone username@hostname:project1.git

You are now set up. Use git as normal and push changes back to the server using a normal git push.