github是使用ssh认证的。
所以先要创建一个公钥/私钥对
ssh-keygen -t rsa -C "your_email@youremail.com"
运行之后会看到如下:
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 your_email@youremail.com使用如下命令将key复制到剪贴板
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测试是否成功:
ssh -T git@github.com# Attempts to ssh to github
若成功将会看到:
ou may see this warning:
# The authenticity of host 'github.com (207.97.227.239)' can't be established. # RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48. # Are you sure you want to continue connecting (yes/no)?
Don't worry, this is supposed to happen. Verify that the fingerprint matches the one here and type "yes".
# Hi username! You've successfully authenticated, but GitHub does not # provide shell access.