我解決了這個問題,下面這個步驟 - 分步說明:
步驟1:檢查SSH密鑰
$ cd ~/.ssh
# Checks to see if there is a directory named ".ssh" in your user directory
# If it says "No such file or directory" skip to step 3. Otherwise continue to step 2.
第2步:備份和刪除現有的SSH密鑰
$ ls
# Lists all the subdirectories in the current directory
# config id_rsa id_rsa.pub known_hosts
$ mkdir key_backup
# Makes a subdirectory called "key_backup" in the current directory
$ cp id_rsa* key_backup
# Copies the id_rsa keypair into key_backup
$ rm id_rsa*
# Deletes the id_rsa keypair
步驟3:生成新的SSH密鑰
$ ssh-keygen -t rsa -C "[email protected]"
# Creates a new ssh key using the provided email
# Generating public/private rsa key pair.
# Enter file in which to save the key (/home/you/.ssh/id_rsa):
# Enter passphrase (empty for no passphrase): [Type a passphrase]
# Enter same passphrase again: [Type passphrase again]
# Your identification has been saved in /home/you/.ssh/id_rsa.
# Your public key has been saved in /home/you/.ssh/id_rsa.pub.
# The key fingerprint is:
# 01:0f:f4:3b:ca:85:d6:17:a1:7d:f0:68:9d:f0:a2:db [email protected]
步驟4:添加您的SSH密鑰到GitHub上
$ sudo apt-get install xclip
# Downloads and installs xclip
$ xclip -sel clip < ~/.ssh/id_rsa.pub
# Copies the contents of the id_rsa.pub file to your clipboard
然後,轉到hithub,並做到:
- 轉到您的帳戶設置
- 點擊「SSH密鑰」,在左邊欄中
- 點擊「添加SSH密鑰」
- 密鑰粘貼到「重點」 領域
- 點擊輸入你的GitHub密碼 「添加鍵」
- 確認操作
步驟5:測試所有的東西
$ ssh -T [email protected]
# Attempts to ssh to github
如果正常,你會看到
Hi username! You've successfully authenticated, but GitHub does not
# provide shell access.
否則(碰巧我),你會看到
Agent admitted failure to sign using the key.
# debug1: No more authentication methods to try.
# Permission denied (publickey).
爲了解決這個問題
$ ssh-add
# Enter passphrase for /home/you/.ssh/id_rsa: [tippy tap]
# Identity added: /home/you/.ssh/id_rsa (/home/you/.ssh/id_rsa)
原創資訊
https://help.github.com/articles/generating-ssh-keys
https://help.github.com/articles/error-agent-admitted-failure-to-sign
ssh-add does事情。再次感謝... – 2014-10-16 16:08:56
對不起,您如何輸入路徑?我的路徑是C:\ Documents and Settings \ admin \ .ssh文件夾。輸入路徑的格式是什麼? – Thinkerer 2014-12-14 17:21:00
而不是'sudo apt-get install xclip'您可能需要運行'brew install homebrew/emacs/xclip-mode' – 2016-02-19 22:37:16