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

Using Workspace SSH Key to push commits

chris_flynn October 18, 2022

I've added an SSH public key to the Workspace settings and the private key has been installed on the build server. The build pipeline is able to clone the code and build it successfully. However, when the pipeline updates the version in the pom.xml file and tries to push back to the remote repo it gets an error message due to the Branch restriction settings. Where do I set the repo permissions for the SSH Keys set in the Workspace settings?

2 answers

0 votes
chris_flynn October 21, 2022

Hi @Erez Maadani , thank you for your response. Sorry for my delayed answer, I didn't get a notification about your comment.

 

Does that mean that SSH keys defined in the Workspace settings can only be used as access keys?

Erez Maadani
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 23, 2022

I think I missed the `pipeline` part...

As mentioned before, access keys are read only.

Pipelines' SSH keys should allow you to push & pull w/o an issue, as long as branch permissions are disabled. From https://support.atlassian.com/bitbucket-cloud/docs/variables-and-secrets/ :

You should be able to push and pull to your Bitbucket Cloud repo with no problems. But, if you need to use SSH, for example, to use a bot account, or when branch permissions are enabled, see Set up an SSH key.

Which branch are you trying to push to and does it have branch restrictions?

BTW, an alternative solution would be to raise a PR from your pipeline and merge it automatically using rest API. 

0 votes
Erez Maadani
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 19, 2022

If the ssh key belongs to a (functional) user, you can change the permissions from the settings -> User and groups access.

If it's an access key, it's a read only access. See here: https://support.atlassian.com/bitbucket-cloud/docs/add-access-keys/

chris_flynn October 21, 2022

Hi @Erez Maadani , thank you for your response. Sorry for my delayed answer, I didn't get a notification about your comment.

 

Does that mean that SSH keys defined in the Workspace settings can only be used as access keys? If the SSH key belongs to a (functional) user then it would have to be defined in that users Personal settings, not the Workspace settings.

Suggest an answer

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

Atlassian Community Events