Version 5, last updated by David Deutsch at May 30, 2011 00:00 UTC

Quick Introduction

First off - forget a lot of what you have learned about Version Control using SVN. A lot still is similar in GIT, but a lot is very different indeed. Think of it like this: SVN is HTTP and Emails. GIT is P2P, OOP, REST and chaos. There is a nice overview in this discussion

The most important concept to understand is that rather than all feeding into and updating from one Repository at the same time, GIT repositories are always local first and are then pushed to and fetched from a central repository, if needed. This allows for more granular commits while doing local tests without clogging up the tubes with SVN updates. It also allows for offline commits that are later pushed to the server.

So rather than connecting to a GIT repository, what you really do is clone it on your own machine, make commits to the code locally and later on push your changes back up to the server.

GIT Push Security in Assembla

What you know for security with SVN does not apply with GIT. Instead of having a username an password to commit to an SVN, you need to set up a private key with RSA and share the public key with the GIT server so it knows who you are when you commit.

How to get the repository set up

Creating an RSA key

In Linux, this is the command to make a public key:

ssh-keygen -t rsa

You should use a good passphrase for additional security. To figure out what the key is later on, use this command:

cat ~/.ssh/id_rsa.pub

which will spit it out in the command line. This is the key that you want added to the keys that are allowed to push to the repository.

Installing EGit

You can get EGit from here

But do make sure that you get the bleeding edge build. The last stable is no use in a security environment like assembla and messes up pretty much any attempt of pushing to the central repository. The bleeding edge build also has a sweet number of new features possibly including that sweet new puppie you always wanted to get her to make up for that thing.

Setting up the repository in EGit

Copy the git URI that assembla tells you for the project, it should look something like this:

git@git.assembla.com:PROJECTNAME.git

Now open up a new perspective of the "Git Repository Exploration" type and tell it to clone a new repository. It should already get the URI from your clipboard and fill everything out for you, so either paste the URI if it did not or click next, next again and then finish.

Right click the new repository location and select "Import Projects" and in the new dialog, select "Import as General Project".

How to commit and push up your commits

Committing is pretty straight forward - just right-click your project and select Team->Commit. Put in a nice comment and you're done.

For pushing, go Team->Push and set it up when doing this the first time - Click next on the first screen, nothing to see here. On the next screen, choose "master [branch]" (or of course, another branch, if you so desire) and "Add spec" next to it. Close it off with next and then finish.

You're all set now!