【问题标题】:How to specify git path in Cygwin terminal?如何在 Cygwin 终端中指定 git 路径?
【发布时间】:2017-10-09 00:15:08
【问题描述】:

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

【问题讨论】:

  • with cygwin 使用它的 git。使用 cygwin ssh-key-gen 创建的 ssh-key 会更容易管理

标签: git ssh cygwin


【解决方案1】:

git 路径本身对 ssh 来说并不重要。

重要的是$HOME,因为 git(任何 git)会在 $HOME/.ssh 中搜索公共/私有 ssh 密钥

在两种情况下仔细检查您的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

【讨论】:

  • $HOME 设置正确,ssh -Tv 的 ssh 身份验证成功。我仍然认为这个 git 设置不正确。
  • @jef 你能否将环境变量GIT_SSH_COMMANDCMD 上的set,bash 上的export)设置为ssh -v,看看在这两种情况下会发生什么git pull ?应该有区别。
  • @jef 你没有提到你使用的是受密码保护的 ssh 私钥 (stackoverflow.com/q/46627127/6309)
猜你喜欢
  • 2021-06-11
  • 1970-01-01
  • 2023-03-03
  • 2014-08-10
  • 2017-01-13
  • 2013-02-11
  • 1970-01-01
  • 2021-02-28
  • 2013-09-14
相关资源
最近更新 更多