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