您的位置:首页 > 其它

Git创建ssh-key

2017-03-01 10:41 330 查看
[align=center]Git创建ssh-key[/align]

远程仓库是Git的一大特色,可以分布在不停地机器上。Github可以实现在线项目的托管,Git与Github是通过SSH加密传输的,需要设置:
第一步:创建SSH Key 在用户主目录下,查看是否有.ssh目录,如果有则跳过,如果没有:打开Git Bash:$ ssh-keygen -t rsa -C "yourmail@example.com"
邮箱地址设置为自己的邮箱地址,然后一个回车,使用默认值即可,也可以设置密码;
如果顺利,可以在主目录里找到.ssh目录,里面有id_rsa和id_rsa.pub两个文件,就是SSH Key的密钥对,id_sra是私密,不能泄露,id_rsa.pub是公钥;
第二步:登录GitHub,打开Accout settings,SSH Keys的页面;然后点Add SSH Key,填上任意title,在Key文本框里粘贴id_rsa.pub文件的内容;

…or create a new repository on the command line

echo "# Testing" >> README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin git@github.com:silicon2016/Testing.git
git push -u origin master


…or push an existing repository from the command line

git remote add origin git@github.com:silicon2016/Testing.git
git push -u origin master


…or import code from another repository

You can initialize this repository with code from a Subversion, Mercurial, or TFS project.

Import code
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: