git push每次都要输入帐号密码的解决方法
问题描述
github每次push代码,都要输入密码,很麻烦。
这是因为clone 的时候是用的https 地址,导致push 的时候默认也是https 方式,所以每次都要输入密码。改成ssh 方式就不用每次都输入密码了。
在终端中输入git remote -v 可以看到远程连接方式:
origin https://github.com/madawang/linux-script.git (fetch)
origin https://github.com/madawang/linux-script.git (push)解决方法
修改连接方式为ssh ,前提是已经在github 的ssh and gpl keys 中添加了当前用户的ssh 密钥。
git remote rm origin
git remote add origin https://github.com/madawang/linux-script.git
git push origin其他
在仓库的右上角可以找到当前项目的https 地址和ssh 地址:

评论已关闭