gitGitHub上有趣的资源程序员

Github提示Key is already use

2016-06-06  本文已影响2737人  Yanqilong

背景:在Github中为用户添加SSH Key的时候报Key is already use,根据错误提示很显然,所添加的SSH Key已经被其他账号使用后,才会出现这个错误。现在有两种解决办法,第一,找到帐号删除Key;第二,重新生成Key

Creates a new ssh key, using the provided email as a labelGenerating public/private rsa key pair.

</code>
</pre>
3.输入需要保存的文件名,同时保存在默认的位置。我使用的是Mac,文件保存在.ssh文件夹下面,可以通过命令,cd ~/.ssh进入。
<pre>
<code>
Enter a file in which to save the key (/Users/you/.ssh/id_rsa): [Press enter]</code>
</pre>
4.输入密码和确认密码,可以跳过
<pre>
<code>
Enter passphrase (empty for no passphrase): [Type a passphrase]

Enter same passphrase again: [Type passphrase again]

</code>
</pre>
到这里,SSH Key已经生成好了,在文件在.ssh目录下

5.SSH Key生成好后,需要添加到ssh-agent才能发挥效果,第一步检查ssh-agent是否启动,如果启动可以看如下效果
<pre>
<code>
$ eval "$(ssh-agent -s)"
</code>
Agent pid 59566
</pre>
6.添加到ssh-agent
<pre>
<code>
$ ssh-add ~/.ssh/id_rsa
</code>
</pre>

记得Github上也要添加对应的SSH Key,完工。哦!还有一件很重要的事情和大家分享,附上此文的Github官方文档,把原汁原味呈现给大家,https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/

同学们如果认为我的文章帮助到你了,给我点赞吧!

上一篇 下一篇

猜你喜欢

热点阅读