首页 > 解决方案 > ssh-agent 的问题:在 Windows 10 上关闭 git 终端后 ssh-agent 不起作用

问题描述

按照bitbucket上的教程,我已经配置了 ssh-agent 并将我的私钥保存在 Windows 10 上的 ssh-agent 中。

To start the agent, run the following:
$ eval $(ssh-agent) 
Agent pid 9700      

Enter ssh-add followed by the path to the private key file:
$ ssh-add ~/.ssh/<private_key_file> 

但是在关闭 git 终端并重新打开它之后,发生了奇怪的事情。

$ ssh-add -l
The agent has no identities.

顺便说一句,在这种情况下,它仍然需要输入私钥的密码。

有人可以告诉我发生了什么以及如何解决这个问题。

标签: gitsshssh-agent

解决方案


关闭终端可能会关闭 ssh-agent。

您应该遵循“ Auto-launching ssh-agent on Git for Windows ”以确保在重新打开git bash会话时.bashrc自动重新启动 ssh-agent。


推荐阅读