您的位置:首页 > 编程语言

使用github托管项目,记录下操作

2012-10-06 01:33 417 查看
github是使用ssh认证的。

所以先要创建一个公钥/私钥对

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.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: