Monday, January 17, 2011

Import or clone remote git (gitorious) repository using Eclipse EGit

Reference : http://www.thinkplexx.com/learn/howto/scm/git/import-or-clone-remote-git-gitorious-repository-using-eclipse-egit


I first had problems, how simple “git clone” can be done using Eclipse Egit. After it worked I decided to write a small how-to.
Basically, I have a remote repository in Gitorious and want it in Eclipse.

Works for:

[v] Ubuntu 9.10
[v] Git
[v] Eclipse Helios
[v] EGit

Should also work for:

[v] most Linux distos
[v] any Eclipse with can EGit

1
Get the Uri and protocols

Gitorious shows the proper Uri. Select your project in Gitorious in web browser and then go to your Repository.
You see “Clone & push urls” (1).
We will need this info:
[+] which protocols are enabled (2) (default is “ssh”)
[+] path for “git clone” (3) (copy it)
get-the-url-and-protocols You can learn more about basic operations on particular repository using ” ? ” in repo view (4).

2
EGit import

In Eclipse: [ Import -> Git -> [Clone BUTTON] ]

3
Fill in data in “Clone Git Repository” dialog

clone-git-reposotory

[star] Copy the path for “git clone” (copied in step 1) into “URI” field. Now, git complains about “Host not supported on file protocol”.
[i] On some systems just pasting the right url and setting the protocol seems to be enough. On others, manual steps are needed as well.
[star] Set the protocol drop down list to be ssh:// if that is the protocol your gitorious shows. Try the [ Next >] button. If it works, go to the step with entering the password. Skip the manual steps described next.
[star] Prefix URI with ssh:// . That changes the protocol.
[star] In host, make sure only host Url is shown, not host.name:project-name (for some reason my Gui always sets it this way). Copy project-name to the ‘repository-path’ input field instead
[star] Do “Next >”. You will be asked for the pass phrase for your SSH “.rsa” or “.dsa” key.
[!!] Important
Here Gitorious expects that you have your private key from the key pair locally. The public key must have been previously stored in the Gitorious.
[star] Enter password for your local private key, if any.

clone-git-repository-2
Now, cloning with Git should work.
That’s it, have fun! ;)

No comments:

Post a Comment