use passpahrse in ssh with ForwordAgent

重启机器后,发现本来等于远程可以git checkout的Repo报告说

fatal: Could not read from remote repository.

Please make sure you have the correct access rights

 

因为是用本地的forward useragent 的.估计是本地的key没有被加入user agent.所以查看本地的 agent.

首先查看key是不是给agent管理了?

ssh-add -L

果然返回

The agent has no identities.

果然没有被管理. 然后用ssh-add mykey

ssh-add yourkey

就把自己的key加入的钥匙串(苹果里叫这个)了.然后在登陆远程,就能顺利checkout了.

 

if the private key is protected with passpharse, before use ssh with forwordAgent, you need to use

ssh-add YourPassparse

to add/store the passparse.

这篇文章对于SSH Key管理讲解的比较清新 。建议阅读。 链接