歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> Github提示Key is already use

Github提示Key is already use

日期:2017/2/28 13:51:49   编辑:Linux教程

背景:在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 "[email protected]"
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 的下載地址:請點這裡

Copyright © Linux教程網 All Rights Reserved