Github提示Key is already use

來源:互聯網
上載者:User

Github提示Key is already use

背景:在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建立個人技術部落格圖文詳解 

GitHub 使用教程圖文詳解   

Git 標籤管理詳解  

Git 分支管理詳解  

Git 遠程倉庫詳解  

Git 本地倉庫(Repository)詳解  

Git 伺服器搭建與用戶端安裝   

Git 概述  

分享實用的GitHub 使用教程  

GitHub 的詳細介紹:請點這裡
GitHub 的:請點這裡

本文永久更新連結地址:

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.