在和同学一起做项目的过程中,一般都会使用到git工具来同步项目的代码。在使用git的时候一定千万(划重点)不要同时修改一份文件,然后上传,这样会产生merge冲突。接下来总结一下我在这几天遇到的问题和解决办法。
fatal: Not a git repository (or any of the parent directories): .git
解决办法:提示说没有.git这样一个目录,使用git init指令即可
fatal: unable to access ‘https://github.com/.../‘: OpenSSL SSL_read: Connection was aborted, errno 10053 解决办法:输入命令关闭ssl认证 git config --global http.sslVerify "false"
fatal: unable to access ‘https://github.com/.../‘: Failed to connect to github.com port 443: Timed out
解决办法:执行 git config --global --unset http.proxy
强制覆盖远程的代码: git push origin main -f
改变分支: git branch -M main
拉取远程代码并不覆盖本地已修改的代码 1、git stash 将本地代码放到暂存区 2、git pull 将远程代码从git上拉取下来 3、git stash pop 将暂存区的代码放回本地 4、正常push:git add . git commit -m "" git push (转自紫菀檀ss)
原文:https://www.cnblogs.com/msd201826010220/p/14779145.html