当我尝试推动我已经提交的更改时,我得到以下错误…

git.exe push -v --progress  "origin" iteration1:iteration1

remote: *********************************************************************
To ssh://git@mycogit/cit_pplus.git
! [remote rejected] iteration1 -> iteration1 (pre-receive hook declined)
error: failed to push some refs to 'ssh://git@mycogit/cit_pplus.git'

这是怎么呢


当前回答

步骤1:

git pull --rebase

步骤2:

git reset --soft HEAD~1

步骤3:

git commit -m "your comments here"

目的:

git push

这应该可以解决您的问题。

其他回答

我敢打赌,你正在尝试一个非快进推球,而钩球挡住了它。如果是这种情况,只需在push之前运行git pull——rebase,在最新的代码库上重新构建本地更改。

在我的例子中,我收到这条消息是因为这个分支在GitLab中被标记为“受保护”。

我遇到了同样的错误,在检查我有一个开发人员访问,不能发布一个新的分支。增加更高的访问权限解决了这个问题。

在我的情况下(Bitbucket),问题是重写分支历史是不允许限制的。 进入存储库设置->分支权限编辑所选分支的权限,并勾选“允许重写分支历史记录”

简单快捷的解决方法:-

Git commit -m "branch_name:添加Git脚本"