运行git version 1.7和maven 3.0.3以及maven release plugin 2.4.2并尝试运行以下命令:
mvn clean install release:clean release:prepare release:perform
我收到以下错误:
[INFO] Checking in modified POMs...
[INFO] Executing: /bin/sh -c cd /home/foo-proj && git add -- pom.xml
[INFO] Working directory: /home/foo-proj
[INFO] Executing: /bin/sh -c cd /home/foo-proj && git status
[INFO] Working directory: /home/foo-proj
[INFO] Executing: /bin/sh -c cd /home/foo-proj && git commit --verbose -F /tmp/maven-scm-1966810637.commit pom.xml
[INFO] Working directory: /home/foo-proj
[INFO] Executing: /bin/sh -c cd /home/foo-proj && git symbolic-ref HEAD
[INFO] Working directory: /home/foo-proj
[INFO] Executing: /bin/sh -c cd /home/foo-proj && git push ssh://git.acmeco.com/gitroot/foo-proj.git master:master
[INFO] Working directory: /home/foo-proj
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1:03.408s
[INFO] Finished at: Sat Jun 14 21:30:48 UTC 2014
[INFO] Final Memory: 13M/57M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.4.2:prepare (default-cli) on project mikesbikes: Unable to commit files
[ERROR] Provider message:
[ERROR] The git-push command failed.
[ERROR] Command output:
[ERROR] To ssh://git.acmeco.com/gitroot/foo-proj.git
[ERROR] ! [rejected] master -> master (non-fast-forward)
[ERROR] error: failed to push some refs to 'ssh://git.acmeco.com/gitroot/foo-proj.git'
[ERROR] To prevent you from losing history, non-fast-forward updates were rejected
[ERROR] Merge the remote changes before pushing again. See the 'Note about
[ERROR] fast-forwards' section of 'git push --help' for details.
[ERROR] -> [Help 1]
特别是这条线导致了这个问题:
git push ssh://git.acmeco.com/gitroot/foo-proj.git master:master
如果我手动执行此操作只是作为git push我没有问题,所以不确定master:master实际意味着什么。
我已经详尽地搜索了在线查找类似问题,只有少数提到相同问题但没有解决方案。任何关于可能是什么问题的建议都将不胜感激。
编辑:这里是-e
标志的输出:
error: failed to push some refs to 'ssh://git.acmeco.com/gitroot/proj-foo.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes before pushing again. See the 'Note about
fast-forwards' section of 'git push --help' for details.
at org.apache.maven.plugins.release.PrepareReleaseMojo.prepareRelease(PrepareReleaseMojo.java:285)
at org.apache.maven.plugins.release.PrepareReleaseMojo.execute(PrepareReleaseMojo.java:232)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:106)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 19 more
Caused by: org.apache.maven.shared.release.scm.ReleaseScmCommandException: Unable to commit files
Provider message:
The git-push command failed.
Command output:
To ssh://git.acemco.com/gitroot/foo-proj.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'ssh://git.acmeco.com/gitroot/foo-proj.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes before pushing again. See the 'Note about
fast-forwards' section of 'git push --help' for details.
at org.apache.maven.shared.release.phase.AbstractScmCommitPhase.checkin(AbstractScmCommitPhase.java:165)
at org.apache.maven.shared.release.phase.AbstractScmCommitPhase.performCheckins(AbstractScmCommitPhase.java:145)
at org.apache.maven.shared.release.phase.ScmCommitPreparationPhase.runLogic(ScmCommitPreparationPhase.java:76)
at org.apache.maven.shared.release.phase.AbstractScmCommitPhase.execute(AbstractScmCommitPhase.java:78)
at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:234)
at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:169)
at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:146)
at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:107)
at org.apache.maven.plugins.release.PrepareReleaseMojo.prepareRelease(PrepareReleaseMojo.java:277)
... 22 more
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
答案 0 :(得分:0)
您的主分支机构是否与远程分支机构保持同步?
另外,您可能想尝试将Git升级到更年轻的版本(让我们说 1.9.x )和最新的maven发布插件,目前 2.5.2 强>
理论:
指定的错误似乎只与Git有关:(即使发布插件在Git上有很不好的声誉)
[ERROR] To ssh://git.acmeco.com/gitroot/foo-proj.git
[ERROR] ! [rejected] master -> master (non-fast-forward)
[ERROR] error: failed to push some refs to 'ssh://git.acmeco.com/gitroot/foo-proj.git'
[ERROR] To prevent you from losing history, non-fast-forward updates were rejected
[ERROR] Merge the remote changes before pushing again. See the 'Note about
[ERROR] fast-forwards' section of 'git push --help' for details.
[ERROR] -> [Help 1]
这通常意味着存在潜在的冲突。
release:prepare
阶段发生的事情是Pom文件更新(使用新版本),新提交是......呃...已提交。
然后会发生的是,如果远程主分支也修改了相同的行,则无法正常推送它。 这也可以解释你之后可以手动运行该行的事实,因为Maven很有可能会回滚这个机会。
所以我倾向于把错误放在Git方面。
但请注意,我不能排除release:plugin
,因为它有时太笨拙,以至于它可能会试图推错一些东西!如果是这样的话,我恐怕无能为力。