在ssh key配置都正确的情况下,突然今天不能拉取和提交代码,找了资料发现是代码拉取协议的关系。
第一步:查看当前协议
$ git remote -v
origin git@git.com:user/project.git (fetch)
origin git@git.com:user/project.git (push)
这种是SSH协议
第二步:删除远程仓库配置
$ git remote rm origin
第三步:添加新的配置
git remote add origin https://github.com/username/project.git
接着再查看一下,发现连接变过来,可以正常拉取、提交代码了~~
$ git remote -v
origin http://git.com/username/project.git (fetch)
origin http://git.com/username/project.git (push)
参考资料:https://blog.csdn.net/s740556472/article/details/80318886