Simple git repository

Stefan "hr" Berder // // code

I love using github for my open source projects but I have a bunch of more personal repositories that I’d like to keep somewhat private. I looked into gitolite, gitorious and gitlab but they seemed complex to install and I wanted something simple.

The simplest way for me was to create a repository folder in my home folder on my server to hold my projects:

myserver$ mkdir ~/repos
myserver$ mkdir ~/repos/project.git
myserver$ cd ~/repos/project.git
myserver$ git init --bare

Then on my laptop, I create a project and add my server as a tracked repository:

laptop$ mkdir project
laptop$ cd project
laptop$ git init
laptop$ git commit --allow-empty -m "ignition"
laptop$ git remote add origin myuser@myserver:repos/project.git
laptop$ git push origin master

And that’s it!! Simple, efficient, easy, job done.

There are ways to get more users to access the repository and restrict what happens when connecting to a common account. You can read more about it in the Pro Git book.