Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Does setting branch permissions for two branches prevent pushing new branches?

jlrosenlof_kr
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 4, 2020

Hello, I've set up branch permissions for two branches, master and example, as follows:

Branch     Access Type                      Users and Groups

Master      Write Access                     Administrators

                  Merge via pull request

Example    Write Access                     Administrators

                   Merge via pull request

 

I am in the Administrators group and another developer is in a group called "Developers".  Both he and I are having trouble pushing branches up to the repository.  For example, when I try to push a local branch up to the repo like this:

> git push origin MyNewLocalBranch

I get the following output:
Counting objects: 4, done.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 4.95 KiB | 0 bytes/s, done.
Total 4 (delta 3), reused 0 (delta 0)
remote: hooks/pre-receive: line 5: /opt/python/domains/bitbucket.org/current/bitbucket/scripts/git/hooks/pre-receive: No such file or directory
To git@someorg.bitbucket.org:someorg/practicework.git
! [remote rejected] MyNewLocalBranch -> MyNewLocalBranch (pre-receive hook declined)
error: failed to push some refs to 'git@someorg.bitbucket.org:someorg/practicework.git'

 

I suspect that this has something to do with the branch permissions because I just set up the branch permissions to protect the two branches above and, prior to setting up branch permissions, we were both able to push local branches to the repository without any trouble.  I have been over the documentation a couple of times and it doesn't mention that setting up branch permissions would exclude other new branches from being pushed.  The documentation doesn't describe this exact situation but it seems to be saying that the branch permissions just affect the listed branches.

 

I don't know if this is relevant or not but, if I go to the website and manually create the branch and then push into it from git, that works with the following output from git:
Counting objects: 4, done.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 4.95 KiB | 0 bytes/s, done.
Total 4 (delta 3), reused 0 (delta 0)
remote:
remote: Create pull request for MyNewLocalBranch:
remote: https://bitbucket.org/someorg/practicework/pull-requests/new?source=MyNewLocalBranch&t=1
remote:
To git@someorg.bitbucket.org:someorg/practicework.git
b2cf75e..ebc796b MyNewLocalBranch -> MyNewLocalBranch

That's fine as a workaround but I would love to be able to get back to being able to push arbitrary local branches in git up to the repository without having to go into the website to create them first every time.

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events