Error: hook rejected to update refs / heads / external_pub when a branch is clicked

I am currently working on the 'external_pub' branch. I made several changes in one file, added it, committed it, and then tried to click:

git push origin external_pub 

But this led to an error:

 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' 

Then I tried to push the branch without any changes to see what was happening (only to isolate the problem). I have done the following:

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

The above command showed:

 # On branch external_pub # Your branch is ahead of 'development' by 5 commits. # nothing to commit (working directory clean) 

Then

 git pull origin external_pub 

He showed: your branch is already up to date

Then

 git push origin external_pub 

This time, he also showed the same error as above. Could you help me solve this problem?

+7
source share
5 answers

There is a git hook on the server that rejected push. Citation:

These scripts run before and after clicking on the server. Pre-hooks can at any time exit a non-zero value to reject a click, and also print an error message back to the client; you can configure push thats policy as complicated as possible.

To find out why, you need to know what the hook does. Hooks are stored in the hooks folder inside the git folder (at the remote end) - find the pre-receive or update hook and check it.

+7
source

On OSX, it is usually caused by the lack of GEM between brew ruby ​​install and Apple ruby ​​2.0 (default).

Include 'require json / ext / parser' or similar add-on not found and exceptions at the required point.

0
source

I solved this problem. I usually use VSTSID (Visual Studio Team Services) in a message when passing code. Follow these steps:

  • git commit --amend (now its time to edit the commit message)

  • git commit -m "vs [your_vsts_id] -your_commit_message>" then click

  • i (keyboard key)

  • Esc (keyboard key)

  • : wq (to save)

After that, you can click (git push).

If you still encounter a problem, type git reset --soft HEAD^ in git bash. Now you can see all your files in green. This means that the files are ready to commit again. Depending on your requirement, you can use the reset ( git reset ) command.

0
source

I had a similar problem when clicking the code .... is this resolved?

0
source

In case you are using Redmine Git Hosting , verify that the project permissions manager role has been assigned to a user who is trying to rewrite his / her git tracking links.

Please note that I assume that you are aware of the effect of git push -force on other users who can share the same remote branch. For more information, check out this article.

0
source

Source: https://habr.com/ru/post/945573/


All Articles