码迷,mamicode.com
首页 > 其他好文 > 详细

git版本管理之git-ssh 配置和使用

时间:2016-07-30 00:32:47      阅读:533      评论:0      收藏:0      [点我收藏+]

标签:

1.设置用户名和邮箱
 $ git config --global user.name "gsx-gh"
 $ git config --global user.email "gsx@126.com"

2.生成密钥

$ ssh-keygen -t rsa -C "gsx@126.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/Administrator/.ssh/id_rsa):
Created directory /c/Users/Administrator/.ssh.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/Administrator/.ssh/id_rsa.
Your public key has been saved in /c/Users/Administrator/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:XwstvBad8mew3XT+IRSPV9+EZEL6WNEje+dW/qzAGFo gsx@126.com
The keys randomart image is:
+---[RSA 2048]----+
|           .+.o  |
|           ..=o. |
|          . .+..o|
|         . *..=.*|
|        S E B+ **|
|         + %.=.+=|
|        . = *.+++|
|         .   +. =|
|              ...|
+----[SHA256]-----+

3.复制/c/Users/Administrator/.ssh/id_rsa.pub中生成的内容,登陆github账号添加ssh-key

技术分享

 

技术分享

技术分享

title自定义

将公钥添加到key中,点击ADD保存

4.测试

  

$ ssh -T git@github.com
The authenticity of host github.com (192.30.253.112) cant be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added github.com,192.30.253.112 (RSA) to the list of known hosts.
Hi gsx! Youve successfully authenticated, but GitHub does not provide shell access.

出现以上信息,则设置成功,可以使用ssh访问提交代码。

ps:以上命令在gitbash软件命令行执行。安装git

 

git版本管理之git-ssh 配置和使用

标签:

原文地址:http://www.cnblogs.com/sagech/p/5719943.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!