Git Hosting Solutions

By Ryan Florence, published 2010-07-27

Part of the issue Git Your Act and Deployment Together.

There are a few ways to host git repositories, some make your life easier than others.

On your server

Gitosis

The current standard (as far as I can tell). We use this at work and it works out really well. It removes the need for everybody to have a user account on our git hosting server. Administration is all done through a git repository on your workstation, then you simply push like any other repository.

$ git clone git://eagain.net/gitosis.git

There’s a README inside the repository to explain how to install. If you run in to issues, google can sort of help, but not always :(

Gitolite

The new kid on the block. We plan to migrate to gitolite as soon as things slow down a bit. Nearly identical to gitosis, but more features; namely, you can prevent users from pushing to certain branches of a repository (stay off my master branch, off-shore dude!) and it actually has documentation.

Plain Jane

Nothing is stopping you from just creating repositories on your server or some network computer and using them. The big draw back, though, is that you’ll be constantly fighting the OS over permissions and user accounts. But for a single developer, or even a team of 2 or 3, there’s absolutely nothing wrong with it.

After git is installed on your server, it’s quite simple:

$ ssh user@domain.com
$ mkdir ~/git
$ mkdir ~/git/my_website.git
$ cd ~/git/my_website.git
$ git --bare init

Bare just means the repository has no working tree (no files) just the git objects. Typically you don’t push to anything but a bare repo. Now on your workstation:

$ git clone ssh://user@domain.com/~/git/my_website.git
$ cd my_website
$ touch README
$ git add .
$ git commit -m 'first commit'
$ git push origin master

Here are some other resources, please comment with other resources you’ve found helpful for your hosting provider:

Third-party hosting

Github

Github is a great choice with tons of features (like pre-rolled post-commit hooks and a web hook system to write your own.) I host all of my open source stuff there, but you can pay a monthly fee to host private stuff as well.

Gitorious

Gitorious is all about open source. Very similar to github, I haven’t used it, so if anybody has, give us a sales pitch in the comments.

Others

The git site maintains a list here

What we’d like from you

Hi, I'm Ryan!

Location:
South Jordan, UT
Github:
rpflorence
Twitter:
ryanflorence
Freenode:
rpflo

About Me

I'm a front-end web developer from Salt Lake City, Utah and have been creating websites since the early 90's. I like making awesome user experiences and leaving behind maintainable code. I'm active in the JavaScript community writing plugins, contributing to popular JavaScript libraries, speaking at conferences & meet-ups, and writing about it on the web. I work as the JavaScript guy at Instructure.