Posts Tagged git

Moving from Subversion to Git

Many teams have their internal scripts in private SVN repositories. It works quite well for most cases. Here’s a short overview of why you may want a transition to Git:

  • Git is distributed. You have the whole history of the project in your local directory. Also your work is independent from central server availability.
  • Branching and merging is in the nature of Git:  whatever new activity you start, you can spin off a new branch and do your commits without disturbing the production code. After testing, you merge your changes into the master branch easily.
  • Bigger choice of transport: Git allows to communicate via SSH, HTTP, its own Git protocol, or by simply archiving and copying your repository if there’s no direct connection to the central server. With SSH transport, you can easily work around strict firewall policies: the pull and push commands are somewhat symmetrical, so if you can’t access the central server for pushing, you can probably pull from your work machine to some intermediate location, and then push to the central server. The possibilities are countless.
  • You can keep all your server or application configuration in Git repositories. This allows you to restore the configuration quickly after an unsuccessful change, and you’re not dependent on the central server availability.
  • You can have as many central servers as you need for your workflow (for example, I use two public repositories for Torrus).

But of course, Git is different, and it needs a bit of learning.  The whole workflow has to be adapted, as well as habits:

  • Your commits don’t go to the central server until you explicitly push them.
  • There is no such thing as revision number. You have SHA hash strings instead.
  • You are encouraged to do more frequent commits, or group them differently. As you do your commits locally without disturbing anyone, you can control the granularity of your commits in a much more flexible way. You can also undo your commits before they are pushed to the central server.

There are many ways to organize your Git repositories:

  • If you work alone and your machine is backed up, you may not even need a central repository.
  • At Github  you can have unlimited public repositories, or a number of private repositories at a cost.
  • Gitorius is a relatively new service, analogous to Github. Also Sourceforge and many other open-source project hosting services offer Git hosting.
  • Gitolite is a nice software that allows you to set up your own Git hosting server easily, with SSH key authentication for multiple users, and access rights. Debian and other packages are available.

UPD: some interesting comments at Hacker News


Leave a comment

Git repository with HTTPS write access

(this is to document a setup which was not used in the end, and was replaced with gitolite)

1. Rent a VPS. For example, at TOCICI a minimal VPS costs as little as $33 per year. The following tutorial is tested with Ubuntu 11.04 on such a minimal VPS.

2. Install and configure Lighttpd

aptitude install git-core lighttpd

Read the rest of this entry »

, , ,