SWGANH Git

From SWGANH Wiki
Revision as of 17:12, 26 March 2010 by Apathy (Talk | contribs) (New page: = Git Setup Guide = Git is a & open source, distributed version control system designed to handle everything from small to very large projects with speed and efficiency. - http://www.git-s...)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Git Setup Guide

Git is a & open source, distributed version control system designed to handle everything from small to very large projects with speed and efficiency. - http://www.git-scm.com/

Over the years the SWG:ANH source has evolved into a massive project both in scope and in terms of number of lines of code, which at last count numbered over 145,000 lines. Up to March 2010 the SWG:ANH project used Subversion as it’s version control system, however, with the source base being the size that it is normal day-to-day tasks such as log lookups and branching/merging were a cumbersome chore. With this in mind the decision was made to switch to an alternative version control system better suited to the task.

Historically, support for Git on Windows was only possible using cygwin however, over the past few years support has improved greatly through projects like msysgit and TortoiseGit. The following guide will walk you through installing Git and configuring for use with SWG:ANH projects.

Installing Git on Windows

To begin download the latest Git installer from the msysgit project site: [1]

At the time of this writing the latest version is Git-1.7.0.2-preview20100309.exe.

Follow the guided installation and select the default options for the Destination Location, Component Selection, and Start Menu Folder pages. When you get to the Adjusting your PATH environment page select the “Run Git from the Windows Command Prompt” option as shown below and continue.

IMAGE PLACEHOLDER

On the following page select “Checkout Windows-style, commit Unix-style line endings.”

IMAGE PLACEHOLDER

The installer will then copy all the necessary files and finish up. Now you’re ready to configure your Git environment for use with the SWG:ANH project.

Generating an SSH Key

In order to authenticate with the SWG:ANH Git repository you will first need to set up an SSH key. To do this open the Git Bash shortcut located on your Desktop or from the Start Menu in the Git folder.

From the command prompt enter the following to start off the generation of your SSH key. Be sure to use your swganh.org email address to generate the key! NOTE: If you have not been assigned a swganh.org account yet, see Snow to get one set up.

ssh-keygen -C "[email protected]" -t rsa

Once you’ve run the above command you will be asked to select a name for the SSH key, simply hit enter to select the default, id_rsa. You will then be asked to optionally enter (and re-enter) a password. NOTE: Do not forget the password if you set one here, you will need it when performing operations on the remote repository.

In your Windows user directory you will now have a folder labeled .ssh with the SSH key files like the following:

IMAGE PLACEHOLDER

Open the id_rsa.pub file and copy the contents into an email or private message to Snow who will enable your access on the Git repository server. That’s it for the SSH key setup, you’re now ready to clone your first SWG:ANH project!

Configure Git and Checkout SWG:ANH Projects

Now you’re ready to configure Git and checkout the MMOServer and MMOServerDB projects which are the heart of the SWG:ANH server. First open a command prompt and navigate to the directory where you want to checkout the projects into, for windows Vista/7 users you can Shift+Right Click on a directory to bring up the Open command window here option.

Once you have the command window open at the location you want enter the following two commands to configure Git to identify yourself correctly with the SWG:ANH Git Repository.

git config --global user.name "yournick"
git config --global user.email "[email protected]"

With your configuration set you’re now ready to check out the MMOServer project with the following command:

git clone [email protected]:mmoserver.git

The first time that you check out a project from the SWG:ANH Git Repository you receive a message asking you if you wish to continue connecting, simply enter yes to continue. You will also be asked to enter the passphrase that you selected when setting up your SSH key at this point, enter it to continue checking out the source. The initial clone will take a minute or two to complete, albeit much faster than the SVN checkouts use to take!

Once the MMOServer clone has finished it’s time to do the same for the MMOServerDB project. Enter the following command for that:

git clone [email protected]:mmoserverdb.git

After the MMOServerDB project has been cloned you’re now ready to start working on the project! For those who are coming over from SVN and are not comfortable working with the command line on a regular basis read on to the next chapter on setting up TortoiseGit, the TortoiseSVN alternative for Git projects.