问题描述
github 每次 push 代码,都要输入密码,很麻烦。
这是因为 clone
的时候是用的 https
地址,导致 push
的时候默认也是 https
方式,所以每次都要输入密码。改成 ssh
方式就不用每次都输入密码了。
在终端中输入 git remote -v
可以看到远程连接方式:
1 2 |
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
密钥。
1 2 3 |
git remote rm origin git remote add origin https://github.com/madawang/linux-script.git git push origin |
其他
在仓库的右上角可以找到当前项目的 https
地址和 ssh
地址:
评论