Pushing the code (using git push) to "testmaster" branch similar to master branch (having restrictions)

Hello Team,
I have a “testmaster” branch in Bitbucket, which have some (write and merge via pull requests) restrictions defined in Bitbucket. Only a set of specific group of users can do the manipulation to this branch .

I have a job in Jenkins which merges our release branch to main branch. However at the time of “git push” it throws an error as follows :

remote: Permission denied to update branch testmaster.
To bitbucket.org:73bit/probench.git
** ! [remote rejected] testmaster → testmaster (pre-receive hook declined)**
error: failed to push some refs to ‘bitbucket.org:73bit/probench.git’

The error is pretty obvious basis the restrictions we imposed on this branch.

However, if we still want to push the changes to this restricted “testmaster” branch via Jenkins, do we have any other way around?

Regards

You are going to have to get the Jenkins user added to that restricted set of users that are allowed to push. This is purely a BitBucket issue.

Hello Ken,
The user is already a part of that “Administrators” group, who has unrestricted access. AFAIK, if I try to push the code using the same account via SourceTree / Fork, it allows to do so, however, that’s not the case with Jenkins

I do hope you managed to figure this out in all this time.

I’d focus on what those pre-receive hooks are and why it’s declining Jenkins

Hello Ken,
No, the issue still persists and need to ponder on the same. As of now I am not finding any workarounds.

Regards
Pratik