必须不断删除/添加ssh密钥到github

时间:2017-08-29 07:35:38

标签: git macos github ssh ssh-keys

我一直有这个奇怪的问题。我刚刚将我的mac升级到sierra,我为github生成了一个新的ssh密钥。

问题是,我将我的ssh密钥添加到gihub并且它的工作时间为15分钟,之后我收到错误

Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

所以我最终做了

pbcopy < ~/.ssh/id_rsa.pub

我删除了github中的ssh密钥并再次添加。我必须每隔15分钟继续这样做。有没有人知道问题是什么?

1 个答案:

答案 0 :(得分:0)

这纯粹与Mac Sierra相关,可以是read here

使用

生成新密钥
ssh-keygen -l -f ~/.ssh/id_rsa.pub

如果您收到以 2048 SHA256 之类的内容开头的回复,那么您应该好好去。只需将其复制到github。

如果没有,你必须运行

ssh-keygen -t rsa

按照你的建议去做。我遇到了同样的问题,Quincy的解释帮了我很多。