Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/blackberry/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Git 错误:hook在推送分支时拒绝更新refs/heads/external_pub_Git - Fatal编程技术网

Git 错误:hook在推送分支时拒绝更新refs/heads/external_pub

Git 错误:hook在推送分支时拒绝更新refs/heads/external_pub,git,Git,目前,我在“外部酒吧”分部工作。我在一个文件中做了一些更改,添加了它,提交并尝试推送: git push origin external_pub 但这导致了一个错误: remote: error: hook declined to update refs/heads/external_pub To ssh://XXX/testing.git ! [remote rejected] external_pub -> external_pub (hook declined) error: fa

目前,我在“外部酒吧”分部工作。我在一个文件中做了一些更改,添加了它,提交并尝试推送:

git push origin external_pub
但这导致了一个错误:

remote: error: hook declined to update refs/heads/external_pub
To ssh://XXX/testing.git
! [remote rejected] external_pub -> external_pub (hook declined)
error: failed to push some refs to 'ssh://XXX/testing.git'
然后,我尝试在不做任何更改的情况下推动分支,以查看发生了什么(只是为了隔离问题)。我做了以下工作:

git reset --hard <commit_id> (to reset to last working sha commit)
git status
然后

它显示:您的分支已经更新

然后

这一次,它显示了与上面相同的错误。您能帮我解决这个问题吗?

服务器上有一个服务器拒绝推送。引述:

这些脚本在推送到服务器之前和之后运行。预弯钩 可以随时退出非零以拒绝推送以及打印 将错误消息返回给客户端;您可以设置一个推送策略 你想怎么复杂就怎么复杂


要找出原因,你需要知道钩子的作用。钩子存储在git文件夹(远程端)内的
Hooks
文件夹中-找到预接收钩子或更新钩子并检查它。

在OSX中,它通常是由brew ruby安装和Apple ruby 2.0(默认)之间缺少GEM引起的


未找到include“require json/ext/parser”或类似的加载项,并且require点出现异常。

我解决了此问题。通常我在提交代码时在消息中使用VSTSID(VisualStudioTeamServices)。使用以下步骤:

  • git提交--修改(现在是编辑提交消息的时候了)

  • git commit-m“vs[您的\u vsts\u id]-您的\u commit\u消息>” 然后按

  • i(键盘按钮)

  • Esc(键盘按钮)

  • :wq(要保存)

  • 之后,您将能够推(gitpush)


    如果您仍然面临这个问题,请在git bash中键入
    git reset--soft HEAD^
    。现在,您可以看到绿色的所有文件。这意味着,文件再次准备好提交。根据您的要求,您也可以使用reset(
    git reset
    )命令。

    如果您使用的是,请检查您的projet权限Manager角色已分配给试图重写其git跟踪引用的用户


    请注意,我假设您知道git push-force对共享同一远程分支的其他用户的影响。有关更多详细信息,

    在my.git/hooks文件夹中,没有pre-receive.sample,我有post-receive.sampleIt应该在远程上,而不是本地repo上。要重置,请使用git重置头~
    # On branch external_pub
    # Your branch is ahead of 'development' by 5 commits.
    #
    nothing to commit (working directory clean)
    
    git pull origin external_pub
    
    git push origin external_pub