Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

! [remote rejected] master -> master (pre-receive hook declined)

kiusau December 12, 2019

Having tried several modifications of the GIT PUSH command and having consistently received the identical failed result.  I reset the following two GIT parameters to true and ran a simple GIT PUSH command.

The parameters:

• export GIT_TRACE_PACKET=1
• export GIT_TRACE=1

Please consider the following entries that appeared in the two TRACE reports:

00:19:31.466801 pkt-line.c:46 packet: push< 9e90193697bf3ea2ad1fc750fa19add51f1486c4 refs/heads/Branch-to-Write\0report-status delete-refs side-band-64k quiet atomic ofs-delta agent=git/2.10.5

00:19:31.527740 pkt-line.c:46 packet: push> 0a5e60b5cd0fe68e2c981d5407b6cac14e3ff79d d8c040f55a91ef9532ab572235fcabf21ae02a10 refs/heads/master\0 report-status side-band-64k agent=git/2.2.1

00:19:31.527953 run-command.c:351 trace: run_command: 'pack-objects' '--all-progress-implied' '--revs' '--stdout' '--thin' '--delta-base-offset' '--progress'

00:19:31.529569 exec_cmd.c:130 trace: exec: 'git' 'pack-objects' '--all-progress-implied' '--revs' '--stdout' '--thin' '--delta-base-offset' '--progress'

00:19:31.538291 git.c:349 trace: built-in: git 'pack-objects' '--all-progress-implied' '--revs' '--stdout' '--thin' '--delta-base-offset' '--progress'

Do any of the above provide a clue to the following error message:

00:19:32.131730 pkt-line.c:46 packet: push< \2Permission denied to update branch master.
remote: Permission denied to update branch master.00:19:32.132723 pkt-line.c:46 packet: push< \1000eunpack ok0033ng refs/heads/master pre-receive hook declined0000

Note:  the Branch-to-Write repository was set up by my partner.  I gave him write permissions and asked him to create for himself a branch.  He modified a file and push it to origin master on the Bitbucket cloud.  His push is properly logged.

Please advise.

Roddy

2 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Answer accepted
Daniil Penkin
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 12, 2019

Hello @kiusau,

It looks like you have branch restrictions in place for the master branch. Specifically, no one can push to that branch directly.

Can you double check repository settings and confirm or disprove this assumption?

Let me know what you find.

Cheers,
Daniil

kiusau December 14, 2019

If it is any clue, I did not have this problem before I granted write privileges to my new development partner, and he has not reported any problems.

In order to incorporate recent changes that he appears to have made online I recall having invoked a PULL request and MERGE command from the BitBucket interface -- both of these succeeded.  These changes were then pulled to my local repository at GIT's suggestion.

As already stated, I have since deleted my local repository and cloned it afresh.  After redoing the troubled commit with a new ADD and COMMIT I received the same error message when I tried to PUSH it.

Roddy

Daniil Penkin
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 14, 2019

Hello @kiusau,

I can't say for sure without knowing what is the repository in question, but what you describe sounds like branch permissions – in this case recloning and pushing again should indeed fail.

Can you check the following for me please:

  • Go to your repository Settings
  • Click on Branch permissions

What do you see on the right side of the screen? Is there a table with some rules, like one in the red rectangle on my screenshot?

 Branch permissions — Bitbucket 2019-12-15 18-36-41.png

Or is there an empty state screen, like this one?

 Branch permissions — Bitbucket 2019-12-15 18-40-49.png

If you have some branch permissions (like on the first screenshot) please double check their configuration or post a screenshot here – I believe you have a rule preventing pushes to your master branch.

Let me know what you find.

Cheers,
Daniil

kiusau December 15, 2019

My menu is not blank, as you suggest, but I see nothing that would deny my ability to PUSH unless, of course, there is something about a PUSH command that I do not understand.  This latter is, of course, very likely, as I am still very new to Bitbucket and the use of GIT.

Now, it does add special restrictions, but these restrictions, if am reading them correctly restrict only two things:  one, the ability to destroy the branch, and two, the ability to change the history. But neither, of these two restrictions refers to a specific group or user.

Finally, the owner (me) is listed, but in this context only mention of my recent PULL and MERGE requests is made.

Please advise.

Roddy

branch_permissions.png

Daniil Penkin
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 15, 2019

So from your initial post, you're trying to push some commits to master but get this error back:

00:19:32.131730 pkt-line.c:46 packet: push< \2Permission denied to update branch master.
remote: Permission denied to update branch master.

This is because you have a restriction to not allow anyone push to master:

branch_permissions.png

The only way to apply changes to master with your current setup is to open a pull request against it, which then can only be merged by you (this is the second setting in that permission – where your username is shown).

If you want to be able to push to master directly, you need to update this branch permission or remove it (depending on what is the desired workflow you'd like to enforce).

Hope this helps. Let me know if you have any questions.

Cheers,
Daniil

kiusau December 15, 2019

Hi, Daniil!

$
Last login: Sat Dec 14 20:25:56 on ttys000
$ git push --all
Counting objects: 5, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (5/5), done.
Writing objects: 100% (5/5), 539 bytes | 0 bytes/s, done.
Total 5 (delta 3), reused 0 (delta 0)
To ... dc64360..5e88b25 master -> master
$

I would like to thank you for your help and ask one last question.  Is it now possible to deny PUSH permissions to my partner.  Or, is that even necessary so long as I check to see what he has done before pulling his changes to my own local repository.

Roddy

Daniil Penkin
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 15, 2019

No worries, I'm glad we found what was causing the problem :)

Is it now possible to deny PUSH permissions to my partner.

There's no way to blacklist users, only whitelist. That is, you can allow only some specific users to push directly – if you add only yourself, no one except you will be able to push to a branch directly.

 Branch permissions — Bitbucket 2019-12-16 13-19-46.png

Or, is that even necessary so long as I check to see what he has done before pulling his changes to my own local repository.

This depends on the repository permissions settings. If you allow write access, they can write to any branch unless there're branch permissions in place. If you use fork-pull request strategy, you can keep just read access for them, and hence such branch permission isn't necessary.

Cheers,
Daniil

kiusau December 15, 2019

Daniil!  You have been one very helpful contributer.  May you spend a very happy holiday!  Many thanks!

Roddy

Like Daniil Penkin likes this
Daniil Penkin
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 15, 2019

Thank you for the kind words! I'm always happy to help :)

0 votes
kiusau December 14, 2019

Hi, Danill.  I would like to thank you for responding, but after two days of fumbling I decided to start over and reinstalled the repository on my local machine and recommit the desire change.  Unfortunately, the result was the same.

Now, I have explored the link that you provided, as well as my setting, and can find nothing wrong.  Now, it may be that I am looking in the wrong place, but truly I have done my best.

Can you suggest anything else? 

I am very frustrated and would hate to have set up a new Bitbucket account each and every time that I run into trouble, as I am not the only one who is using it.

Roddy

TAGS
AUG Leaders

Atlassian Community Events