Wednesday, 20 October 2010

git & github from windows

While learning Grails and working though 'Grails in Action' I wanted to save my work to a repository. SVN can be a pain to setup on windows and many people use github & so I thought I would give it a go.

Sadly I am on a windows PC but I have just been so pleasantly surprised as to how easy it was.

This is what I had to do:
  1. I work from a cygwin command shell. In this I had to have ssh & git executables installed.
  2. help to set up the ssh key is here .
  3. I did not realise that git acts as a local repository as well as a public repository so you are under no obligation to upload your work. The local set up is a breeze and is described in this excellent tutorial, running the commands from my cygwin shell.
  4. There is even a GUI with the command 'gitk'
  5. create the repository on the remote server such as the public github repository
  6. Once you want to upload the code to a public github repository it is a simple case of running the following commands:
  7. cd existing_git_repo
    git remote add origin git@github.com:bill-comer/hubbub.git
    git push origin master
  8. And you can download code from github using the following:
  9. git clone   git@github.com:bill-comer/hubbub.git
  10. As I am on a windows PC I had to tweak the SSH2 key location. In eclipse go to Preferences/Network Conections/SSH2. Here I set the SSH2 home to where my cygwin .ssh directory is. In my case C:\cygwin\home\comerb\.ssh.


Now go ahead and enjoy a free and easy to use code repository.

1 comment:

Bill Comer said...

the tutorial has disappeared. but there are lots of free docs. Here is one - http://progit.org/book/