git - 如何在 Cygwin 终端中指定 git 路径?

标签 git ssh cygwin

我安装了 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/

相关文章:

ssh - 使用事件目录的无密码 ssh 身份验证

git - 如何使用别名访问 Jenkins 中的远程 Git 存储库?

git - Jenkins Git 插件分离 HEAD

windows - Windows 网络共享上的 GIT 中央存储库

linux - 在 Git 中限制远程通信

linux - 将多个文本文件合并在一起,同时保留行顺序

c - 报告显示使用 Eclipse CDT 的 gprof 为 "no time accumulated"

cygwin - 如何从标准输入使用 cp?

git - 如何在不检查的情况下更新 git 子模块

angularjs - Angular 基础教程不适用于 Windows?