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

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

原因推测: 

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

解决方法

一:

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

二:

1. git reset [hash], 再git push

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

原文地址:https://www.cnblogs.com/it-Ren/p/15509666.html