为什么在cygwin下使用git时会要求密码?

7

我在ssh配置文件中正确地指定了密钥文件:

$ cat ~/.ssh/config
Host <host>
        IdentityFile /cygdrive/v/poma.pem

$ ssh git@<host>
PTY allocation request failed on channel 0
Welcome to GitLab, Roman!
Connection to <host> closed.

并且使用Cygwin的Git

$ which git
/usr/bin/git

$ git --version
git version 2.1.4

$ /cygdrive/c/Program\ Files\ \(x86\)/Git/bin/git.exe --version
git version 1.9.5.msysgit.1

但是当我尝试推送时,会显示一个密码提示:

$ git remote -v
origin  git@<host>:poma/deploy.git (fetch)
origin  git@<host>:poma/deploy.git (push)

$ git push -u origin master
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

为什么会发生这种情况?

你说它显示了一个密码提示,但我在你粘贴的文本中没有看到。 - Richard Hansen
因为它显示在窗口中。 - Poma
1个回答

1

为了绕过问题,请仅在 Windows 上进行相同的设置(无需 cygwin),使用最新版本的 git-for-windows(随意解压缩 PortableGit-2.4.4.2-3rd-release-candidate-64-bit.7z.exe,然后你就会得到 git 2.4.4 版本:在此处查看更多信息)。

通过使用 git-cmd.exe(或 git-bash.exe),您将获得一个环境,其中 HOME 已设置为您的 %USERPROFILE%。在其中放置您的 .ssh/config 文件,并尝试再次从您的存储库推送。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接