在名为foobar
的Android项目上,我运行mvn release:prepare
,成功构建应用程序并向Git存储库添加本地提交。然后,当脚本尝试推送到远程存储库时,会发生以下错误:
[ERROR] Failed to execute goal org.apache.maven.plugins:\
maven-release-plugin:2.4.1:prepare (default-cli) on project foobar: \
Unable to commit files
[ERROR] Provider message:
[ERROR] The git-push command failed.
[ERROR] Command output:
[ERROR] fatal: unable to connect to :
[ERROR] : Name or service not known
我使用公钥/私钥来访问名为mylocalserver
的本地服务器:
# ~/.ssh/config
Host mylocalserver-git
HostName 192.168.100.100
User git
IdentityFile ~/.ssh/id_rsa
Git配置引用主机名并指向存储库:
# Git config
remote.mylocalserver.url=git@mylocalserver-git:foobar.git
Maven也知道服务器:
<!-- pom.xml -->
<scm>
<developerConnection>
scm:git:git://mylocalserver-git:foobar.git
</developerConnection>
</scm>
项目的目录结构如下:
├── .git
├── .settings
├── assets
├── bin
├── docs
├── gen
├── gen-external-apklibs
├── libs
├── out
├── res
├── src
├── target
├── tmp
├── .classpath
├── .gitignore
├── .project
├── AndroidManifest.xml
├── ic_launcher-web.png
├── pom.xml
├── proguard.cfg
├── project.properties
├── README
我可以将远程服务器与任何Git命令一起使用,例如git push mylocalserver master
。为什么Maven失败了?
我可以在prohibit maven to push
the release:
答案 0 :(得分:1)
检查Maven Git SCM的已接受语法。您的:
scm:git:git://mylocalserver-git:foobar.git
应该是:
scm:git:git://mylocalserver-git/foobar.git