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

Permission denied (publickey) with maven scm plugin

mafuj_jia
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!
July 19, 2023

Hi folks,

my pipeline step is failing while executing below command

mvn -B -s .etc/ci/settings.xml release:clean 
release:prepare -DconnectionUrl=scm:git:$BITBUCKET_GIT_HTTP_ORIGIN 
-DautoVersionSubmodules=true -DscmCommentPrefix="[skip ci]" 
-Darguments=-DskipTests

with the error

[ERROR] The git-push command failed.
[ERROR] Command output:
[ERROR] Warning:********@bitbucket.org: Permission denied (publickey).

I am not sure which/whom public key is referring to

 

1 answer

0 votes
Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 19, 2023

Hello @mafuj_jia and welcome to Atlassian Community!

I see you have opened an internal ticket reporting this issue, so I'm just sharing the resolution here in case someone from the community comes across the same error.

When pushing back to a repository from within a pipeline build, the ssh key used will by default be the one defined in Repository Settings > SSH Keys (under Pipelines section). 

On that page, you can either use your own existing key or get Bitbucket to generate the keys for you. Once the keys are setup, you will need to copy the public key and add it as an Access key in the Workspace (Workspace Settings > SSH Keys) that contains the repo you are pushing to.

It's important to note that only Workspace access key provides read and write access. Project-level access keys and repository-level access keys only provide read access - more details on Difference between repository, project an workspace access keys .

Thank you, @mafuj_jia !

Patrik S

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events