Git on Dreamhost

How to setup and use Git on Dreamhost

Before Git, Linux kernel developers were using a distributed version control system called BitKeeper. The developer of BitKeeper withdrew its free license for the Linux kernel developers, so they were in need of a new version control system.

The developers wanted something distributed, fast, and safe. No other version control system met their needs, so Linus Torvalds decided to make his own.

Git development began in April 2005. Within four days, it became self hosting. By June, developers began using it to manage the Linux kernel — its original purpose.

Git's popularity has exploded over the past few years, especially with the introduction of GitHub — the famous social code hosting website. It's used for several prominent open source projects. If you're a developer, chances are you're going to be using Git for version control (or Subversion).

Dreamhost and Git

Dreamhost is a popular shared web hosting service — for good reason. They offer features like unlimited storage and bandwidth. This works well for developers who want to host their git repositories on Dreamhost servers.

Not all servers in Dreamhost's service has Git installed on it, but most do. To check if your server has Git, just secure shell in and try:

$ git help

If a help message pops up, congratulations! There's nothing else you need to do because Git is already pre-installed on this server.

If Git isn't pre-installed, you have two choices:

  1. Contact Dreamhost support and ask them, nicely, to install Git on your server.
  2. Try installing a local copy of Git for yourself.

To install a local copy of Git:

$ wget http://kernel.org/pub/software/scm/git/git-1.6.0.4.tar.bz2
$ tar xjf git-*
$ cd git-*
$ make all
$ mkdir ~/bin
$ mv git-*/bin/* ~/bin/.

Be sure to add ~/bin to your $PATH in ~/.bash_profile.

Using Git

Git works really well over SSH. User management is done with the Dreamhost panel, simply add a new SSH user.

$ git init --bare myrepo.git

You can check out the Git repository via:

$ git clone user@domain.com:~/myrepo.git

With Dreamhost's web panel, you can even setup WebDAV to serve your Git repository over HTTP instead of SSH. Just log into the web panel, go to Goodies, then Htaccess/WebDAV. Create a WebDAV directory and move your git repository into that directory.

Other hosts that support Git

If you're still on the fence about Dreamhost, you can find other hosts at Django Hosting.