Using git to develop sites (developers only)

We have recently moved our Drupal and WordPress repositories to git. We will also be putting our databases and static site filesystems there too, so we can generate test sites locally with a simple script. Here’s how to get started with developing sites:

Installing and configuring Git

  • Mac OS X: Go to download page and download the latest version.
  • On Windows: Go to download page and download Git-{version}-preview{release date}.exe

To configure git, there are some nice instructions here…

(VS Users: Aparajita has supplied in ticket SYSADM-610 to configure your git install: just download it, use Terminal to go to the directory where the script is, and type sh You will be asked for full name and email address.)

Using git

To create a version of the Drupal or wordpress repository on your local site, create a directory. Open Terminal, go to that directory and use:

git clone git@{servername}
git clone git@{servername}

This will put the contents of the repository in that folder. Note: If the repository uses gitolite to control access via ssh, you must have the appropriate ssh keys on your machine to do this. In addition, you need to have these lines in your .ssh/config file

host gitolite
user git
hostname {server}
port {port_name}

To make changes to the repository, you have a few options:

  • Use the command line ๐Ÿ™‚
  • There is a git client called SmartGit which is free for non-commercial purposes. We are still in the initial stages of testing it, but right now it seems to have everything we need
  • There is a application called GitX which has a very nice interface that shows all commits and lets you commit to your local version of the repository. However (at the moment) you still need to use the command line to update your local filesystem from the server repository (using Terminal, go to the directory and type git pull) and then push your changes back to the server repository (git push)