标签:
此错误出现原因是:在github上添加新key时,不正确到拷贝了~/.ssh/id_rsa.pub内容所致。一般发生在linux下,因为windows下用notepa++打开这个文件并复制一般是没有问题的,而linux下使用vim打开再复制就会因为vim添加了回车而导致key添加失败。解决办法是:使用cat命令将.ssh/id_rsa.pub内容输出到终端,再拷贝。
ls -al ~/.ssh # Lists the files in your .ssh directory, if they exist
ssh-keygen -t rsa -b 4096 -C "your_email@example.com" # Creates a new ssh key, using the provided email as a label # Generating public/private rsa key pair.
Enter file in which to save the key (/Users/you/.ssh/id_rsa): [Press enter]
Enter passphrase (empty for no passphrase): [Type a passphrase] # Enter same passphrase again: [Type passphrase again]
Your identification has been saved in /Users/you/.ssh/id_rsa.
# Your public key has been saved in /Users/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 your_email@example.com
# start the ssh-agent in the background eval "$(ssh-agent -s)" # Agent pid 59566
ssh-add ~/.ssh/id_rsa
来源:https://help.github.com/articles/generating-ssh-keys/
github ssh key Key is invalid. Ensure you've copied the file correctly解决办法
标签:
原文地址:http://www.cnblogs.com/aprils/p/5025770.html