我解决了这个问题,下面这个步骤 - 分步说明:
步骤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