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

Cannot allow push to repository via API for a specific user

Hansi B_
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!
March 1, 2024

Hi there,

via the API, I want to restrict pushing for new repositories to specific groups and users. This works nicely for most cases - as described in the API documentation, I can restrict pushing, e.g., for user ABC and group XYZ using

{
"branch_match_kind": "glob", "pattern": "main",
"kind": "push",
"users": [ { "username": "ABC" } ],
"groups": [ { "slug": "XYZ" } ]
}

However, there is one user for whom this does not work - the administrative "Jenkins" user. For him, I get an error

"error": {"message": "write or admin access required: jenkins"}

I would have thought this means that "Jenkins" requires specific access to the repository, but even giving him admin permissions on the repository did not help. At the same time, I can allow pushing for "Jenkins" manually in the GUI (even without the admin permissions).

I am wondering if this has to do with my limited admin status in our company workspace - while I am an admin in the specific project where I want to import the repositories, I have few permissions beyond.

I am using an AppPassword that has Write+Admin access both for "Projects" and "Repositories" (and Read access for "Workspace membership").

Any ideas anyone?

Cheers

C.

1 answer

1 accepted

2 votes
Answer accepted
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 5, 2024

Hi @Hansi B_ and welcome to the community!

This error shows when the user you are trying to add does not have at least write permissions to the repo. I believe you are using the wrong username. I checked the workspaces you have access to, and although there is a user with Name 'Jenkins' in one of them, the username of this account is different.

If you have access to this account's credentials, you can log in to https://bitbucket.org/ with that user's email and password and find the username here: https://bitbucket.org/account/settings/. If you don't, you can ask the person who set up this account to check.

Please feel free to let me know if you have any questions.

Kind regards,
Theodora

Hansi B_
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!
March 13, 2024

Thank you, that was indeed the problem. An admin has provided me with the uuid of the "Jenkins" user, and using that works:

{
"branch_match_kind": "glob", "pattern": "main",
"kind": "push",
"users": [ { "uuid": "{abcdef-xyzxyzyxz-123etc}" } ]
}
Like Theodora Boudale likes this
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 13, 2024

That's good to hear, thank you for the update. Please feel free to reach out if you ever need anything else!

Like # people like this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events