问题
Github使用代码提交时,每次都要输入账号和密码。之前改过一个repo,但是没有记录下来,又废了好多时间,幸好又解决了。
原因
git中的remote端是https://格式,需要改成git@格式
方法步骤
1.首先查看remote路径
git remote -v
如果出现
origin https://github.com/YourName/YourRepo.git(fetch)
origin https://github.com/YourName/YourRepo.git(push)
那么就是问题的根源了。
2.修改url
git remote set-url origin git@github.com:YourName/YourRepo.git
- com后面是冒号":"
- YourName和YourRepo在第一步的查看中有
- 不要把".git"写成".get"
3 查看与测试
git remote -v
查看是否修改成功,并进行后续的测试。