我的身份验证失败了。我创建了SSH密钥,公钥已由本地git管理员导入,但仍然会提示输入密码:
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
”(没有前面的点),只是为了好的措施。HOME
system var设置为我的用户的正确目录。答案 0 :(得分:0)
ssh -vvv git@repo
返回什么?
只要此ssh请求不起作用,git操作就不会与git@repo
服务器一起使用。
如果ssh报告确实尝试提供publickey,那么你必须仔细检查它是否已正确添加到repo服务器上的~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就会知道要使用的公钥的用户,主机名和完整路径。