- 问题引入:
每次提交本地代码到Git远程仓库都会需要手动的输入密码和账号才能提交点(下图)
![85f55717db0cb1e75284c85be9399b49.png](https://img-blog.csdnimg.cn/img_convert/85f55717db0cb1e75284c85be9399b49.png)
查阅文档使用git提交到github,每次都要输入用户名和密码的解决方法 - 一字一句 - 博客园 初步发现是git remote add 的时候使用的是https方式,而不是ssh方式
2.验证是否真的使用的是https方式
使用命令:
git remote -v
![b14a13c1600c6d4fb9ff97b12b5f3f9c.png](https://img-blog.csdnimg.cn/img_convert/b14a13c1600c6d4fb9ff97b12b5f3f9c.png)
看的出来显示的的确是https的方式。
3.修改https的方式为ssh方式
如果没有在账号中添加sshkey 可以参考https://zhuanlan.zhihu.com/p/81338250
移除当前关联的远程仓库
git remote rm origin
添加新的ssh地址
git remote add oring ssh地址
4.再次提交
git push origin master
这次没有再提示输入密码