git 报错集结(持续更新)

remote: HTTP Basic: Access denied
密码不一致导致的,解决方案如下:
打开:控制面板--》选择用户账户--》选择管理你的凭据--》选择windows凭据--》-普通凭据-》选择git的信息--》编辑或删除

image.png

git提交报错:husky > commit-msg hook failed (add --no-verify to bypass)
原因:当你在终端输入git commit -m "XXX"提交代码时,pre-commit(客户端)钩子,它会在Git键入提交信息前运行做代码风格检查,若不符合规则,则报错(规则是依据.git/hooks/pre-commit文件里面的相关定义)

// 方案一
      卸载husky,执行npm uninstall husky --save也可以,再次提交,自动化测试功能就屏蔽掉
// 方案二
      进入.git文件夹,再进入hooks文件夹,删除pre-commit文件,重新git commit -m 'xxx' git push即可
// 方案三
      将git commit -m "XXX" 改为 git commit --no-verify -m "XXX"

Failed to connect to Operation timed out

Updates were rejected because the tip of your current branch is behind

// 方案一:强制push的方法(这样会使远程修改丢失,不可取,尤其是多人协作开发时)
      git push -u origin master -f
// 方案二:先pull后push
      git pull origin master
      git push -u origin master

git 无法push远程仓库 Note about fast-forwards 问题解决
原因:没有指定本地master分支和远程origin/master的连接

/*
  解决方案:
    因为远程仓库新建时,有LIENCE;
    由于本地仓库和远程仓库有不同的开始点,也就是两个仓库没有共同的commit出现,无法提交,此时我们需要allow-unrelated-histories
*/ 
git pull origin master --allow-unrelated-histories
git pull --allow-unrelated-histories  // 如果设置默认分支,可以这样写
然后git push

error: Cannot delete branch 'xxx' checked out at 'xxxx'

删除分支时,当前分支不能停留在要删除的分支上,要切换到其他任意分支,再去删除目标分支

你可能感兴趣的:(git 报错集结(持续更新))