问题描述

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 ,前提是已经在githubssh and gpl keys 中添加了当前用户的ssh 密钥。

git remote rm origin
git remote add origin https://github.com/madawang/linux-script.git
git push origin

其他

在仓库的右上角可以找到当前项目的https 地址和ssh 地址:

最后修改:2020 年 02 月 16 日
如果觉得我的文章对你有用,请随意赞赏