Getting Groovy (and Grails)

Explorations in Groovy and Grails Development

Git and Unfuddle

leave a comment »

I happen to be using Unfuddle for a number of my projects. Here are instructions for working with a git repo in Unfuddle. Start by signing up for an account with Unfuddle, then create a test project (make sure the initial repository type is git). Click on the repositories tab and you’ll see that there is an initial repo. Click on the repo and it’ll provide initial instructions for getting started. Here is a summary of what you need to do.

Before you can connect to Unfuddle securely, you’re going to need an SSH key pair.

On a Mac, start by entering “cat ~/.ssh/id_rsa.pub”. If you have a file, you’re already set up with an SSH key pair. If not you’ll need to “ssh-keygen -t rsa”. Just OK all of the default options, and then “cat ~/.ssh/id_rsa.pub” to get the key.

On a windows machine, create the project directory in windows explorer. Right click on the directory and select “Git Bash here”. At the command prompt, enter “ssh-keygen -C “username@email.com” -t rsa” (with your own username and email). Use the default location, and when prompted, enter (and remember) your keyphrase. Keep a note of where it stored the keyfile, open it with a text editor, and then copy the contents of that file as that is the key.

Once you have your key (whether on a Mac or Windows),log into Unfuddle, click on “personal settings” (top right), scroll down to “public keys”, click “new public key” with a meaningful title (e.g. “work computer” or “Dell laptop”) and paste the value of your key into the “value” textarea. Click on “add” and within a couple of minutes you’ll be able to use that SSH key to connect to Unfuddle.

Now that you’ve entered your SSH key, you will want to create a local repo: “mkdir projectname”, “cd projectname”, “git init”. You then need to associate the Unfuddle repo to the local one. The commands will be something like: “git remote add unfuddle git@accountname.unfuddle.com:accountname/projectname.git” (replace the accountname and projectname as appropriate) followed by “git config remote.unfuddle.push refs/heads/master:refs/heads/master”. Then you need to “git add .” and “git commit -m ‘initial commit'” to add and then commit any initial files. Finally, “git push unfuddle master” to push your initial commit to Unfuddle.

Once you’ve done this, all additional users will just have to “git clone git@accountname.unfuddle.com:accountname/projectname.git” (replacing the accountname and projectname with your account and project names) to get a copy of the repository. It’ll ask you to enter a copy of the passphrase and then will download a copy of the repository to your machine. When you later want to push your changes to Unfuddle, just “git push”, enter the passphrase and you’ll upload all your changes (and their history) to the Unfuddle repo.

Advertisements

Written by peterbell

June 5, 2009 at 1:55 pm

Posted in git

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: