在名为foobar
I run的 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失败了?
当我禁止 Mavenpush
发布时,我可以抑制错误: