我为我的 github 帐户设置了一个私钥,我相信它的密码存储在 OS X 的钥匙串中。当我打开终端窗口并输入ssh git@github.com
.
但是,当我在 ssh 会话上或本地在 tmux 会话中运行 bash 时,每次尝试 ssh 到 github 时,我都必须输入密码。
这个问题表明 screen 存在类似的问题,但我不太了解这个问题,无法在 tmux 中修复它。还有这个页面,其中包含一个相当复杂的解决方案,但用于 zsh。
编辑:
为了回应@Mikel 的回答,我从本地终端得到以下输出:
[~]
$ echo $SSH_AUTH_SOCK
/tmp/launch-S4HBD6/Listeners
[~]
$ ssh-add -l
2048 [my key fingerprint] /Users/richie/.ssh/id_rsa (RSA)
[~]
$ typeset -p SSH_AUTH_SOCK
declare -x SSH_AUTH_SOCK="/tmp/launch-S4HBD6/Listeners"
Run Code Online (Sandbox Code Playgroud)
而通过 ssh 或 tmux 我得到:
[~]
$ echo $SSH_AUTH_SOCK
[~]
$ ssh-add -l
Could not open a connection to your authentication agent. …
Run Code Online (Sandbox Code Playgroud)