ssh-agent 无法使用 git

ssh-agent not working with git

在全新安装的 Cygwin 上(之前使用 git-bash),我无法将 ssh-agentgit 一起使用。

ssh-agent 配置良好,因为 ssh 命令有效。

$ ssh git@bitbucket.org
PTY allocation request failed on channel 0
logged in as lenouveau.

You can use git or hg to connect to Bitbucket. Shell access is disabled.
Connection to bitbucket.org closed.

但是当使用 git 命令时,它似乎没有加载我的 ssh 密钥。

$ git fetch
git@bitbucket.org: Permission denied (publickey).
fatal: Could not read from remote repository.

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

git-gui 效果很好。

使用另一个终端(例如:git-bash),它也可以工作。

我的 .ssh 文件夹:

$ ls -al ~/.ssh
total 38
drwx------+ 1 LeNouveau Aucun      0  3 juil. 11:39 .
drwxrwx---+ 1 Système  Système    0  3 juil. 11:37 ..
-rw-------+ 1 LeNouveau Aucun    133  3 juil. 11:39 agent.env
-rwx------+ 1 LeNouveau Aucun   1766 16 avr.  09:33 id_rsa
-rwx------+ 1 LeNouveau Aucun    402 16 avr.  09:33 id_rsa.pub
-rwx------+ 1 LeNouveau Aucun   3013 26 juin  14:34 known_hosts

我错过了什么?

好的,发现我的错误:我使用的是我的 windows 命令 git(来自 git 的 windows)而不是 cygwin 命令。

卸载 Windows 并安装 cygwin 解决了我的问题。