2011-03-15 67 views
2

我的驗證失敗。我已經建立了我的SSH密鑰和公共密鑰已經被當地的git管理的進口,但我仍然得到提示輸入密碼:使用git和tortoisegit在Windows XP上驗證失敗

git.exe clone --progress -v "[email protected]:project.git" "C:\web\project" 
Cloning into C:\web\project... 
[email protected]'s password: 
fatal: The remote end hung up unexpectedly 
  • 我的SSH密鑰passphraseless和「C:\Documents and Settings\username\.ssh」下的生活,我也將它們複製到「C:\Documents and Settings\username\ssh」(沒有前面的點),只是爲了好的措施。
  • 在Windows環境變量的屏幕,HOME系統變量被設置爲我的用戶正確的目錄。

回答

0

ssh -vvv [email protected]返回什麼?

只要這個SSH請求不起作用,沒有git的操作將與[email protected]服務器工作。
如果ssh的報告,它是確實試圖提供公鑰,則必須仔細檢查它已正確添加到回購服務器上的~git/.ssh/authorized_keys文件。

這裏是例子SSH會話中的提取物的工作原理:

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. 

兩點意見:

  • %HOME%引用不%HOMEDIR%而是一個自定義驅動器(p:\),這是一個本地公約在工作中,可能不適用於你。
  • 我的公/私鑰的名稱不遵循默認的標準(id_rsa.pub/id_rsa

我加了config文件中%HOME%\.ssh目錄,以名稱,明確了公共密鑰文件:

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

這樣,我可以簡單地鍵入:ssh gitrepo,而ssh將知道使用哪個用戶,主機名和確切的完整路徑。