I connect Bitbucket from my Jenkins pipeline using ssh. I need to push some code to my repository from pipeline. If I give write permission to "Everybody" then push is working. But I want to restrict write permission only to this ssh user. there is no option to select ssh user in "Branch Permission" section of the repository settings.
Hi @Chetan Korat and welcome to the community.
In the branch permissions dialog, you can grant access to certain Bitbucket users or user groups of the workspace only, it is not possible to grant access to a certain SSH key pair.
Is the SSH key pair you use for Jenkins added to- a certain Bitbucket user?- or a Bitbucket workspace (from workspace Settings > SSH keys)?
If this SSH key is added to a workspace instead of a user, then I'm afraid that it is not possible to add the workspace to branch permissions, as the workspace is a container for the repositories and not an actual user. If you'd like to make use of branch permissions, you will need to use an SSH key pair that is associated with a Bitbucket user with access to the repo, and then add this user in branch permissions.
We have a feature request to support SSH key specific branch permissions:
If you'd be interested in that, I would suggest adding your vote there (by selecting the Vote for this issue link) as the number of votes helps the development team and product managers better understand the demand for new features. You are more than welcome to leave any feedback, and you can also add yourself as a watcher (by selecting the Start watching this issue link) if you'd like to get notified via email on updates.
Implementation of new features is done as per our policy here and any updates will be posted in the feature request.
Please feel free to let me know if you have any questions.
Kind regards,Theodora
Thanks a lot for your quick reply. This was indeed the problem. My SSH Key was added at workspace level. Added a new key at user level, gave that user repo access and it worked.
Kind regards,
Chetan
You are very welcome Chetan, please feel free to reach out if you ever need anything else!
Hi Theodora,
I don't think adding the ssh key to a specific user is solution, what if the user leaving the company and the account is closed?
On the other hand you can create jenkins bitbucket user for that purpose, but that required email address, verification, and all the fun.
I should be able to give write permissions to ssh users, I don't see any reason why it blocked by design.
Regards,
Avishay
It looks like you're new here. Sign in or register to get started.