Why git under cygwin asks for password?

纵饮孤独 提交于 2019-12-22 04:37:23

问题


I correctly pointed to key file in ssh config:

$ 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.

and using cygwin's 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

But when I try to push it displays a password prompt:

$ 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.

Why is that happening?


回答1:


As a workaround, try doing the same setup (~/.ssh/config) on Windows only (no cygwin, with the latest git-for-windows (unzip anywhere you want PortableGit-2.4.4.2-3rd-release-candidate-64-bit.7z.exe, and you got git 2.4.4: see more here)

By using a git-cmd.exe (or git-bash.exe), you will get an environment where HOME has been set to your %USERPROFILE%.
In it, put your .ssh/config file, and try again pushing from your repo.



来源:https://stackoverflow.com/questions/29865786/why-git-under-cygwin-asks-for-password

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!