【发布时间】:2021-11-27 22:47:18
【问题描述】:
我想知道是否可以得到一些帮助。我最近重新安装了我的操作系统,我遇到了一个我以前从未遇到过的奇怪问题。我在关注Github steps to add ssh agent
基本上每次登录都需要运行
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_personal
当我重新启动计算机时。
当我尝试运行 git clone X 时,我得到了
Cloning into 'X'...
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
但是在我运行上面的 2 个命令之后,我 cna 克隆就好了
注意:Gitlab 也存在问题。对不起,我应该是明确的
【问题讨论】:
-
我个人在
ssh-agent模式下使用gpg-agent。它将密钥永久存储在一个文件中,并允许配置它重新询问密码的频率;我的每 12 小时询问一次。我在 XWin 之前启动gpg-agent,因此它可用于我的 X 会话中的所有终端和程序。 -
MacOS 在您登录时通过launchd 启动一个ssh-agent,然后再启动任何窗口,这样窗口就预先设置了ssh 环境变量。您可以获得可以做同样事情的 Linux 软件,但我从未使用过它。我使用的东西更像@phd 描述的方法。