git push 时【remote rejected】 error: 无法推送一些引用到 'xxx'


! [remote rejected] branchA -> branchA (pre-receive hook declined)
error: 无法推送一些引用到 'gitlab.xxx.xxx.xxx/xxx.git'

原因推测: 

  你的commit不是当前分支最新的commit 或者是做了rebase操作造成的, 可以在本地删除有问题的分支,然后再新建刚刚删除的

解决方法

一:

1. git checkout -B onebranch-temp
2. git branch -D onebranch
3. git pull
4. git checkout onebranch
5. git branch -D onebranch-temp
6. git pull
7. git cherry-pick [git log --oneline中的哈希值]
8. git push

 

 

 

二:

1. git reset [hash], 再git push

2. git merge [主分支], 再git push

 

三:

git push -f


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM