Getting error while running bitbucket-pipeline using mvn release:prepare release:perform

Hi Team,

I am getting below error while running "mvn release:prepare release:perform" using bitbucket pipelines. Could you please suggest how to resolve the same?

"[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.4:prepare (default-cli) on project my-webapp: An error is occurred in the checkin process: Exception while executing SCM command. Detecting the current branch failed: fatal: ref HEAD is not a symbolic ref -> [Help 1]["


Kulbhushan Mayer

1 answer

0 votes

Hey Kulbushan,


Pipelines checks out a specific revision/commit when it runs to help test each change to a project, leaving the working copy in "detached head" mode. Maven wants to make additional commits to your repo to record the changes to your pom.xml, and so must be on a branch.

At the beginning of your pipeline you'll want to reset the branch you want to release from, to the current commit. Assuming you're working from master, you would add



git checkout master


From here you'll be on head: master, and able to run maven release.

Please be aware that your release will fail if not running on the latest commit.


Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 06, 2018 in Bitbucket

Upgrade Best Practices

Hello! My name is Mark Askew and I am a Premier Support Engineer for products Bitbucket Server/Data Center, Fisheye & Crucible. Today, I want to bring the discussion that Jennifer, Matt, and ...

655 views 5 9
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you