我安装了 Cygwin 和 TortoiseGit。我通过 ssh-key-gen -t rsa
创建了 ssh-key并将公钥注册到我的 GitHub 页面。在 gitbash
时终端,但是,它可以工作,Cygwin
终端失败。
// Cygwin
$ git pull
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
我注意到他们使用不同的 git。那么,如何在 Cygwin 中指定 git 路径?我的操作系统是 Windows 10。
// Cygwin
$ where git
C:\Program Files\Git\cmd\git.exe
$ which git
/cygdrive/c/Program Files/Git/cmd/git
// gitbash (MINGW64)
$ where git
C:\Program Files\Git\mingw64\bin\git.exe
C:\Program Files\Git\cmd\git.exe
$ which git
/mingw64/bin/git
最佳答案
git 路径本身对 ssh 来说并不重要。
重要的是$HOME
,因为 git(任何 git)会在 $HOME/.ssh
中搜索公共(public)/私有(private) ssh key
仔细检查您的 echo $HOME
两种情况下的输出,并检查 ssh -Tv auser@aserver
的结果(将用户和服务器替换为键入 git remote -v
时看到的 ssh URL 的开头)
另外,Cygwin has its own Git package as I explain here .
和it needs a .bash_profile
as a setting .
关于git - 如何在 Cygwin 终端中指定 git 路径?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46593483/