简体   繁体   English

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

[英]Have to continuously delete/add ssh key to github

I've been having this strange issue. 我一直遇到这个奇怪的问题。 I just recently upgraded my mac to sierra and I generated a new ssh key for github. 我刚刚将Mac升级到sierra,并为github生成了一个新的ssh密钥。

The problem is, I add my ssh key to gihub and it works for like 15mins and then after that I get an error 问题是,我将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.

So I end up doing 所以我最终做了

pbcopy < ~/.ssh/id_rsa.pub

And I delete the ssh key in github and add again. 然后删除github中的ssh密钥,然后再次添加。 I have to keep doing this every 15 mins. 我必须每15分钟执行一次。 Does anyone have any clue what the problem is? 有谁知道这是什么问题吗?

This is purely Mac Sierra related, as can be read here . 这纯粹是与Mac Sierra有关,可以在此处阅读

Generate a new key using 使用生成新密钥

ssh-keygen -l -f ~/.ssh/id_rsa.pub

If you receive a reply starting with something like 2048 SHA256 , you should be good to go. 如果您收到以2048 SHA256之类的开头的回复,那应该很好。 Just copy it to github. 只需将其复制到github。

If not, you have to run 如果没有,您必须运行

ssh-keygen -t rsa

and do as you proposed to do. 并按照您的建议去做。 I had the same problem and Quincy's explanation helped me alot. 我遇到了同样的问题,昆西的解释为我提供了很多帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM