Auth fails on Windows XP with git and tortoisegit

后端 未结 1 1858
渐次进展
渐次进展 2020-12-12 02:05

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:

<         


        
相关标签:
1条回答
  • 2020-12-12 02:25

    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.

    0 讨论(0)
提交回复
热议问题