7

Attempting to perform a release on a maven project, which has successfully released before.

When I perform mvn release:prepare I am prompted for the release tags and the new snapshot tags and the project builds.

But when it attempts to push to the remote, I get

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.0:prepare (default-cli) on project NeuralAnalysis: Unable to tag SCM [ERROR] Provider message: [ERROR] The git-push command failed. [ERROR] Command output: [ERROR] To ssh://gitosis@10.41.129.2/NeuralAnalysis.git [ERROR] ! [rejected] NeuralAnalysis-1.5.6 -> NeuralAnalysis-1.5.6 (non-fast-forward) [ERROR] error: failed to push some refs to 'ssh://gitosis@10.41.129.2/NeuralAnalysis.git' [ERROR] To prevent you from losing history, non-fast-forward updates were rejected

And indeed, attempting to perform git push ssh://gitosis@10.41.129.2/NeuralAnalysis.git NeuralAnalysis-1.5.6 manually, also exits with the same complaint.

Performing git pull says 'Already up-to-date'. git branch shows I am on the 'master'. git push origin gives 'Everything up-to-date'.

Looking at the repository using Tower shows that 'master', 'origin/master' and 'NeuralAnalysis-1.5.6' are all the same and on the last commit. The working directory contains release.properties and pom.xml.releaseBackup files.

It looks to me like everything is fine with the repository overall.

1
  • 1
    Do you have (locally or on the remote) a branch named NeuralAnalysis-1.5.6 like the tag you are trying to push? Can you edit your question with the output of a git push --verbose ssh://gitosis@10.41.129.2/NeuralAnalysis.git NeuralAnalysis-1.5.6?
    – VonC
    Jun 4, 2012 at 5:10

1 Answer 1

14

Turns out it was a remote tag with the same name, as suggested by VonC in the comment. This was likely created by some previously aborted release.

Although I found the remote tag by manually inspecting the refs/tags directory on the remote repository, git ls-remote --tags will show them as well and the git push --verbose will also show more about the problem in general.

To fix this, first retrieve the remote tags with git fetch --tags.

One way to perform the next step is then to simply bypass that release tag by updating the pom.xml to have a higher -SNAPSHOT version (including any references in the same project by other modules to that snapshot), check these in, and do mvn release:clean; mvn release:prepare over again.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.