安装Git
此处略去一万字
了解几个东西
为什么要配置公钥、私钥?配置了有什么用(对于Git)?怎么配置?
(以后补充)
Git 配置SSH公钥、私钥
1、进入Git Bash
鼠标右键<Git Bash Here>(或者文件路径里敲<Git Bash.lnk>)
2、输入生成 Rsa 秘钥对的命令
ssh-keygen -t rsa -C "your_email@example.com"
3、秘钥名称
Enter file in which to save the key (/c/Users/CL/.ssh/id_rsa): <输入秘钥名称/直接回车>
注:本例中,输入秘钥名称为:lisheng741
4、输入密码和确认密码
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
都可空,直接回车,等待生成秘钥对。
本地会生成两个文件:
lisheng741 私钥
lisheng741.pub 公钥
5、本地添加私钥
ssh-add <私钥路径>
eg: ssh-add ~/.ssh/id_rsa
6、读取公钥
方式1:cat <公钥文件>
方式2:以文本方式打开公钥文件
将公钥文本复制,用于下一步
7、在 Github / Gitee 添加公钥
Github:点自己头像 >> Settings >> SSH and GPG keys >>New SSH key
Gitee:点自己头像 >> 设置 >> SS公钥
Git配置SSH公钥、私钥 踩坑记录
问题1:
第5步本地添加私钥时,提示:
Could not open a connection to your authentication agent.
具体原因没有细究,解决方案:先执行命令:ssh-agent bash
问题2:
Windows 10 启动自带 ssh-agent 报错 :
unable to start ssh-agent service, error :1058
解决办法
Set-Service -Name ssh-agent -StartupType automatic
下一步将本地代码推到远程gitserver上
如何将本地项目推到git上 http://www.stararly.com/Drupal/3476.html
没有评论,留下你的印记,证明你来过。
◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。