git常见错误记录
1 Git报错fatal:Authentication failed for‘https://git……解决方法 方法一配置全局参数: git config --global user.name “xxx” git config --global user.email “xxx” 方法二: git remote -v git remote remove origin git remote add origin xxx 方法三(可以解决): git config --system --unset credential.helper 执行这个命令之后,你可以重新写入账号密码,这样就可以重新提交代码了。
2 fatal: not a git repository (or any of the parent directories): .git 这个错误
需要用以下指令来初始化一个新的Git仓库:
git init
3 fatal: refusing to merge unrelated histories"
它表示Git拒绝将两个不相关的代码历史合并在一起。这通常发生在以下情况下: 创建一个新的Git仓库后,尝试将其与另一个已存在的仓库合并。 两个仓库的提交历史没有共同的祖先。 要解决这个问题,可以采取以下步骤: 如果你希望合并这两个仓库的历史,可以在合并命令中使用 --allow-unrelated-histories 选项,例如: git merge --allow-unrelated-histories <另一个仓库的URL或路径> 这将允许Git将两个不相关的历史合并在一起,但你需要小心,确保没有冲突或其他问题。
或者直接
git pull origin master --allow-unrelated-histories
4 warning: in the working copy of ‘XXX.py’, LF will be replaced by CRLF the next time Git touches it
git config --global core.autocrlf false
浙公网安备 33010602011771号