SSH连接Git的配置

发布时间:2021-09-14 17:28:52 作者:chen
来源:亿速云 阅读:94

这篇文章主要讲解了“SSH连接Git的配置”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“SSH连接Git的配置”吧!

如果使用ssh的方式管理,需要配置ssh key.

1、打开git bash命令窗口
2、生成ssh key
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

your_email@example.com为github上你注册的email地址。

如下面完整创建过程:

$ ssh-keygen -t rsa -b 4096 -C "test@qq.com"
Generating public/private rsa key pair. Enter file in which to save the key (/c/Users/Administrator/.ssh/id_rsa): 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:chS9dRlB6Ee+E6/Ob9plXh6HXgDhhOk6mpST+oqrCxA test@qq.comThe key's randomart image is: +---[RSA 4096]----+ |        .. o++++ | |         .+oo.+  | |E       .. +.+.  | | .     .  o . +. | |.     .oS.   . +o| |.     =oo     ooo| |.    o + .     +*| |.  .. o      ..=*| |ooo..o.      .++=| +----[SHA256]-----+

上面默认生成在用户主目录的.ssh目录下,可以自己输入自定义位置。

3、把ssh key添加到github

复制文件c/Users/Administrator/.ssh/id_rsa.pub内容,把key添加到:github > settings > SSH and GPG keys > New SSH key > 粘贴保存。

4、测试SSH连接
$ ssh -T git@github.com

如下面表示已经连接成功:

$ ssh -T git@github.com
Hi Javastack! You've successfully authenticated, but GitHub does not provide shell access.

现在你可以通过SSH方式来clone及提交代码了。

更多详细配置请参考官方配置:

https://help.github.com/articles/connecting-to-github-with-ssh/

感谢各位的阅读,以上就是“SSH连接Git的配置”的内容了,经过本文的学习后,相信大家对SSH连接Git的配置这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是亿速云,小编将为大家推送更多相关知识点的文章,欢迎关注!

推荐阅读:
  1. SSH 配置
  2. VS2012配置Git并连接到osc@git

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

ssh

上一篇:如何使用Java实现学生信息管理系统

下一篇:SpringBoot怎么监控Redis中某个Key的变化

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》