我的身份validation保持失败。 我已经创build了我的SSH密钥,公钥已经被本地的git admin导入,但是我仍然被提示input密码:
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
C:\Documents and Settings\username\.ssh
”下C:\Documents and Settings\username\.ssh
,我也将它们复制到“ C:\Documents and Settings\username\ssh
”(没有前面的点)。 HOME
系统var被设置为我的用户正确的目录。 什么ssh -vvv git@repo
返回?
只要这个ssh请求不起作用,git操作将不会与git@repo
服务器一起工作。
如果ssh报告它是否尝试提供公钥,那么您必须仔细检查它是否已正确添加到repo服务器上的〜git ~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
) 我在%HOME%\.ssh
目录中添加了一个config
文件,以便明确指定公钥文件:
host gitrepo user git hostname repo identityfile ~/.ssh/mypubkey
这样,我可以简单地键入: ssh gitrepo
,而ssh将知道哪个用户,主机名和确切完整路径的公钥使用。