Maven release fails due to git failure

Tobb picture Tobb · Nov 30, 2012 · Viewed 10.8k times · Source

I am trying to do a mvn release, but it fails due to problems with git. I have done this multiple times before without this problem, and I really don't get why/how this is happening.

I first got it doing mvn release:prepare, but got around it by adding the last line shown below to my root-pom:

    <artifactId>maven-release-plugin</artifactId>
    <configuration>
      <preparationGoals>clean install</preparationGoals>
      <pushChanges>false</pushChanges>

But now, when I try to do mvn release:perform, I get the error message again:

[INFO] Executing: cmd.exe /X /C "git clone file://C\Users\torbjornk\nfr\MyProject/ C:\Users\torbjornk\nfr\MyProject\target\checkout"
[INFO] Working directory: C:\Users\torbjornk\nfr\MyProject\target
[ERROR] The git-clone command failed.
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE  
[INFO] ------------------------------------------------------------------------
[INFO] Unable to checkout from SCM
Provider message:
The git-clone command failed.
Command output:
fatal: 'C:/Program Files (x86)/Git' does not appear to be a git repository
fatal: The remote end hung up unexpectedly

I do not get where it gets the idea that my git-installation-folder is supposed to be a git repository! The git clone-command logged right before the error is happening does not contain a reference to this folder either..

Answer

HaveAGuess picture HaveAGuess · Dec 15, 2012

Just to add to Tobb's excellent original answer..
I noticed that this has been fixed but had issues getting the new version to work.. You have to add it as a plugin (not project) dependency, eg.

<!-- Appengine deploy at end of mvn release:perform -->
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-release-plugin</artifactId>
    <version>2.2.2</version>
    <dependencies>
        <dependency>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-scm-plugin</artifactId>
            <version>1.8.1</version>
        </dependency>
    </dependencies>
</plugin>