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.

在这种情况下,仍然需要输入私钥密码。

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

解决方法

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

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