手机版
你好,游客 登录 注册 搜索
背景:
阅读新闻

Github提示Key is already use

[日期:2016-06-07] 来源:简书  作者:Yanqilong [字体: ]

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


找到使用该Key的帐号,在Github个人信息中有SSH and GPG keys这一栏,管理着所有的SSH Keys,找到匹配的Key删除,另外一个账号就可以使用该Key了


重新生成SSH Key,仅需几个简单的步骤1.打开终端2.输入以下命令,并执行
$ ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
Creates a new ssh key, using the provided email as a labelGenerating public/private rsa key pair.

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


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


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

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

GitHub 教程系列文章: 

通过GitHub创建个人技术博客图文详解  http://www.linuxidc.com/Linux/2015-02/114121.htm

GitHub 使用教程图文详解  http://www.linuxidc.com/Linux/2014-09/106230.htm 

Git 标签管理详解 http://www.linuxidc.com/Linux/2014-09/106231.htm 

Git 分支管理详解 http://www.linuxidc.com/Linux/2014-09/106232.htm 

Git 远程仓库详解 http://www.linuxidc.com/Linux/2014-09/106233.htm 

Git 本地仓库(Repository)详解 http://www.linuxidc.com/Linux/2014-09/106234.htm 

Git 服务器搭建与客户端安装  http://www.linuxidc.com/Linux/2014-05/101830.htm 

Git 概述 http://www.linuxidc.com/Linux/2014-05/101829.htm 

分享实用的GitHub 使用教程 http://www.linuxidc.com/Linux/2014-04/100556.htm 

GitHub 的详细介绍请点这里
GitHub 的下载地址请点这里

本文永久更新链接地址http://www.linuxidc.com/Linux/2016-06/132089.htm

linux
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款