Question

My authentication keeps failing. I've created my SSH keys and the public key has been imported by the local git admin, but I still get prompted for a password:

git.exe clone  --progress -v  "git@repo:project.git" "C:\web\project"  
Cloning into C:\web\project...  
git@repo's password:  
fatal: The remote end hung up unexpectedly
  • My SSH keys are passphraseless and live under "C:\Documents and Settings\username\.ssh" and I also copied them to "C:\Documents and Settings\username\ssh" (without the preceding dot) just for good measure.
  • In the Windows environment variables screen, the HOME system var is set to the correct directory for my user.
Was it helpful?

Solution

What does ssh -vvv git@repo returns?

As long as this ssh request doesn't work, no git operation will work with the git@repo server.
And if the ssh reports it is does try to offer the publickey, then you must double-check it has been correctly added to the ~git/.ssh/authorized_keys file on the repo server.

Here is an extract of example of a ssh session which works:

debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug3: start over, passed a different list publickey,password,keyboard-interactive
debug3: preferred publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Offering public key: /p/.ssh/mypubkey
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Server accepts key: pkalg ssh-rsa blen 277
debug2: input_userauth_pk_ok: fp f8:d9:7...:cf

debug3: sign_and_send_pubkey
debug1: read PEM private key done: type RSA
debug1: Authentication succeeded (publickey).
debug1: channel 0: new [client-session]
debug3: ssh_session2_open: channel_new: 0
debug2: channel 0: send open
debug1: Entering interactive session.

Two comments:

  • My %HOME% reference not %HOMEDIR% but a custom drive (p:\), this is a local convention at work and might not apply to you.
  • the names of my public/private keys don't follow the default standard (id_rsa.pub/id_rsa)

I have added a config file in the %HOME%\.ssh directory in order to name explicitly the public key file:

host gitrepo
     user git
     hostname repo
     identityfile ~/.ssh/mypubkey

That way, I can simply type: ssh gitrepo, and ssh will know which user, hostname and exact full path of the public key to use.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top