博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Git: Github提示Key is already use
阅读量:4113 次
发布时间:2019-05-25

本文共 1114 字,大约阅读时间需要 3 分钟。

背景:在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官方文档,把原汁原味呈现给大家,

GitHub 教程系列文章: 

通过GitHub创建个人技术博客图文详解  

GitHub 使用教程图文详解   

Git 标签管理详解  

Git 分支管理详解  

Git 远程仓库详解  

Git 本地仓库(Repository)详解  

Git 服务器搭建与客户端安装   

Git 概述  

分享实用的GitHub 使用教程  

GitHub 的详细介绍: 

GitHub 的下载地址

本文永久更新链接地址

转载地址:http://hbrsi.baihongyu.com/

你可能感兴趣的文章
Letter Combinations of a Phone Number
查看>>
Single Number II --出现一次的数(重)
查看>>
Valid Parentheses --括号匹配
查看>>
Remove Element--原地移除重复元素
查看>>
Remove Duplicates from Sorted Array--从有序数组中移除重复元素
查看>>
Count and Say
查看>>
Gas Station
查看>>
Palindrome Partitioning --回文切割 深搜(重重)
查看>>
Valid Palindrome 简单的回文判断
查看>>
Pascal's Triangle -- 生成杨辉三角
查看>>
Pascal's Triangle II 生成杨辉三角中的某行
查看>>
Minimum Depth of Binary Tree -- 二叉树的最小深度 DFS 加剪枝
查看>>
Climbing Stairs 爬楼梯方法 动态规划
查看>>
Merge Two Sorted Lists 合并两个有序链表
查看>>
pow(x,n) 为什么错这么多次
查看>>
Jump Game 动态规划
查看>>
Binary Tree Maximum Path Sum 自底向上求解(重重重重)
查看>>
Subsets 深搜
查看>>
Subsets II
查看>>
Edit Distance 字符串距离(重重)
查看>>