核心提示:windows使用git时会出现的常见操作问题解答。终于稍微会一点git了,所以赶紧把遇到的问题记录下来:1、warning: LF will be replaced by CRLFwindows中的...
windows使用git时会出现的常见操作问题解答。终于稍微会一点git了,所以赶紧把遇到的问题记录下来:
1、warning: LF will be replaced by CRLF
windows中的换行符为 CRLF, 而在Linux下的换行符为LF,所以在执行add . 时出现提示,解决办法:
$ rm -rf .git // 删除.git $ git config --global core.autocrlf false //禁用自动转换
然后重新执行:
$ git init $ git add .
2、fatal: remote origin already exists
输入$ git remote add origin 项目地址时出现出错信息;
解决办法:
$ git remote rm origin $ git remote add origin
然后再输入项目地址 就不会报错了。
3、error:failed to push som refs to …….
输入$ git push origin master时出现出错信息;
解决方法:
$ git pull origin master //先把远程服务器github上面的文件拉下来 $ git push origin master
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 项目地址