Using TortoiseGit on Windows for your Android project (for the beginner and former Subversion user)

September 23, 2010

I use Windows for Android development because I find Eclipse too slow and clunky on the Mac especially on the MacBook Air. Recently I started using GIT for a project having used Subversion exclusively in the past. Given these constraints (Windows and Subversion experience) TortoiseGit seemed the obvious choice for me (I’m not trying to impress my friends with my command line skills any more!).

1) Download and install the lastest TortoiseGit MSI installer from http://code.google.com/p/tortoisegit/
Google code screenshot

2) Create your repository over at GitHub (Assuming you already have an account)
GitHub create repo screenshot

3) Initialise your project as a Git repository by right clicking on your project directory and selecting “Git Create repository here” from the context menu. A .git folder with all the necessary setup will be created within your project folder.
Init git repo on filesystem screenshot

4) Open your project folder and select the files and folders that you wish to include in your git repo (you will want to exclude the /bin and /gen folders for your Android projects). Then right click on these selected items and select “Git Commit -> master …” from the context menu.
commit files screenshot

5) A commit dialog will appear. Write your commit message and select the “select / deselect all” checkbox at the bottom to ensure that all your files are selected. Press OK. It is important to note at this stage your commit is being held locally on your PC as we have not yet linked our filesystem repo with github.com.
git commit msg screenshot

6) Before we can “push” our local commits (plural because you can make many commits locally before pushing them to the server) we must create an ssh key. The easiest way to do this is to open the Git Gui.  Right click on your project folder and select “Git Gui” from the context menu.
Open Git Gui screenshot

7) In Git Gui (notice our unstaged changes on the left), select Help –> Show SSH Key.  A dialogue will appear with your SSH key (if you have one). Most likely you do not have one yet so click the “Generate Key” button and enter a passphrase/password to secure your key when prompted. Your generated key will now appear in the textbox; copy it to the clipboard.
Create SSH Key Screenshot

8 ) Now you must add your ssh key to your github.com account.

a) Sign in to your account at github.com
b) Click the “Account Settings” link (top right of page)
c) Click the “SSH Public Keys” link (left middle of page)
d) Click the “Add another public key” link
e) Give your key a name e.g. github-<your_username> (you might have keys for other things!)
f) paste your key (that you copied to the clipboard in the previous step) into the textarea.
g) click add key
github.com ssh key setup

9) Now that you have created your ssh key and shared it with your github account, we are ready to push our commit (that we made in step 5) to our online github.com repo.  Right click on your project and select “Tortoise Git” –> “Push” from the context menu.
Push to Git screenshot

10) A dialog will appear asking where you would like to push the commit(s) to.  If you navigate to your project on github (e.g. http://github.com/damianflannery/MyProject for me) you will find an ssh url for your project (git@github.com:damianflannery/MyProject.git for my project). Copy your ssh url and paste it in the “Arbitrary URL” field of the dialog and click OK.  You will be asked to enter your passphrase/password for your ssh key and then all being well you will receive a success message.
Git Push Dialog Screenshot

That’s it! Head over to github.com to see your code.

Advertisements

One Response to “Using TortoiseGit on Windows for your Android project (for the beginner and former Subversion user)”


  1. […] This post was mentioned on Twitter by Sergio López Bustos and Damian Flannery, Damian Flannery. Damian Flannery said: Step by step beginners guide to using Git for your Android projects using TortoiseGit on Windows http://bit.ly/azXcWJ […]


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: