今天使用git 添加远程github仓库的时候提示错误:fatal: remote origin already exists.
最后找到解决办法如下:
1、先删除远程 Git 仓库
$ git remote rm origin
2、再添加远程 Git 仓库
$ git remote add origin git@github.com:FBing/java-code-generator
如果执行 git remote rm origin 报错的话,我们可以手动修改gitconfig文件的内容
把 [remote “origin”] 那一行删掉就好了。$ vi .git/config
3、如果遇到error: failed to push some refs to 'xxx(远程库)'
$ git pull
解决了README.md冲突再git push
4、如果出现报错 fatal: Couldn't find remote ref master或者fatal: 'origin' does not appear to be a git repository以及fatal: Could not read from remote repository.
则需要重新输入$ git remote add origin 'xxx'