Click here to register.
      

Git Your Project In Github

Design Squid
Git Your Project In Github
hao · 3/30/2009 1:42 pm

Due to increasing demand from clients, Plain Black is moving to Git. Here are reasons why you should also consider Git for managing your software projects:

http://whygitisbetterthanx.com/


Currently the best known Git hosting provider is Github, and here I will list the steps to import an existing WebGUI project from Subversion to Github. For our examples, we'll pretend that our company is Plain Black and our client is Acme Corporation.

Account Setup

First, if you haven’t already set up your Github account, you’ll need to do that. If you don’t plan on immediately creating a private project, you can start with a free account:

http://github.com/plans


After signing up, you’ll need to provide your SSH public key:

http://github.com/guides/providing-your-ssh-key


If using OS X, you may want to store your private key in your keychain:

ssh-add -K ~/.ssh/id_rsa

Working Setup

For client development purposes, we’ll assume the following layout.

Our custom WebGUI installation will be the root directory. By default, this is:

/data/WebGUI


But for our purposes, that is a symlink to the actual WebGUI installation. For example:

. /data/wre/sbin/setenvironment.sh
mkdir -p /data/tmp
cd /data/tmp
curl -O http://www.plainblack.com/downloads/builds/7.5.25-stable/webgui-7.5.25-stable.tar.gz
tar zxvf webgui-7.5.25-stable.tar.gz
rm webgui-7.5.25-stable.tar.gz
mv WebGUI /data/WebGUIAcme


Using the switch_webgui.pl script (available from the WebGUI Bazaar), we’ll change the active WebGUI installation:

perl switch_webgui.pl --no-wre-restart WebGUIAcme


Depending on whether you want to maintain your own copy of WebGUI, you may want to commit just altered files and not the entire WebGUI installation. Here we’ll just assume you’ll commit everything.

We’ll also assume the extra client code outside of WebGUI will live in a subdirectory, which you may prefer to call “local,” but for our purposes we’ll name it after the client:

/data/WebGUIAcme/acme


The reason we’ll use the client’s name for the local subdirectory is that we may have several client sites all using the same WebGUI installation. For example:

/data/WebGUIAcme/acme
/data/WebGUIAcme/acme.org
/data/WebGUIAcme/acme.gov

Git Your Working Copy

Let’s convert the WebGUI installation to a local Git repository. First, let’s remove any stray Subversion metadata:

cd /data/WebGUIAcme
find . -name .svn -type d | xargs -I{} m -r {}


Initialize and commit the newly prepared code base:

git init
git add .


Now use git-svn to clone your existing Subversion repository:

git svn clone -T / https://svn.webgui.org/acme
git add acme


By cloning our existing Subversion repository, we can resync with it later if necessary.

Now let’s commit:

git commit -m “Initial commit of Acme Corporation client code and custom patched version of WebGUI 7.5.25-stable”

Github Push

Copy the path from the project page, and specify Github as a remote repository:

git remote add github git@github.com:plainblack/acme.git


Check your new settings for the new remote repository:

cat .git/config


Now push:

git push github master


… and you’re done.

·
Stick
Lock
Subscribe