Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to use Git for the first time (I have used Mercurial before so I know the basic setup).

Everything is ready on the server side with the following properties:

  • User name: git
  • Domain: mydomain.com
  • Port: 222
  • Repo path: /home/git/repo.git
  • Public key saved in: /home/git/.ssh/authorized_key
  • Private key saved on my local Windows machine.
  • The key pair was generated with PuTTYgen

During installation of Git on my Windows machine I chose OpenSSH if that matters.

So my question is, how do I check out my repo?

Thanks.

share|improve this question
    
PuTTYgen generates the key in different format than OpenSSH expects. Do you have it in openssh format in %USERPROFILE%\.ssh\id_rsa and %USERPROFILE%\.ssh\id_rsa.pub as OpenSSH expects? –  Jan Hudec Feb 5 at 12:39
    
Note that Git Gui has a menu for generating/showing the ssh key. That's the easiest way to generate it so that it is properly set up for git. –  Jan Hudec Feb 5 at 12:40

2 Answers 2

git clone username@server:/path/to/git/repo.git while you are in the folder where you want to check out to.

share|improve this answer
    
Thanks, but how do I specify my custom port (222) and where my private key is? –  monoceres Dec 8 '11 at 16:38
    
These are probably the answers you need: stackoverflow.com/questions/7772190/… –  Tim Dec 8 '11 at 16:41

Use [user@]host:relpath to clone over SSH, or ssh://[user@]host[:port]/abspath if you need to specify a different port.

For your current configuration:

ssh://git@mydomain.com:222/home/git/repo.git

or

ssh://git@mydomain.com:222/~/repo.git

With OpenSSH, you need to export your private key to OpenSSH format (using PuTTYgen), then either a) save it as ~/.ssh/id_rsa or ~/.ssh/id_dsa depending on the type, or b) save it anywhere you like, then edit ~/.ssh/config IdentityFile to point to the file. (a is better if you use the same key to connect everywhere; b is better if you use different keys for different servers.)

On Windows, the location is %USERPROFILE%\.ssh, and you'll probably need to create the .ssh directory yourself using Command Prompt.

If you had chosen PuTTY/plink, you could double-click the .ppk key file to load it to Pageant, and it would be used automatically.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.