我正在尝试通过 https 将 maven 发布插件与 git 结合使用(出于某些不明原因,我无法通过 ssh 使用 git),但是,我收到以下错误消息:
14:36:52 [ERROR] The git-push command failed.
14:36:52 [ERROR] Command output:
14:36:52 [ERROR] fatal: could not read Username for 'https://my.company.git.host.com': No such device or address
14:36:52 [ERROR] -> [Help 1]
浏览网页,我想在我的 pom.xml 文件中设置以下属性:
<scm>
<connection>scm:git:https://my.company.git.host.com/Project/project.git</connection>
<developerConnection>scm:git:https://my.company.git.host.com/Project/project.git</developerConnection>
</scm>
以下内容已添加到我的 settings.xml(位于 ~/.m2
文件夹下。我已通过使用 -X 运行 maven 检查了这一点
标志)
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
https://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<server>
<id>my.company.git.host.com</id>
<username>svc.jenkins.project</username>
<password>guesswhat</password>
</server>
</servers>
</settings>
重要说明:
如果我直接在 connection
和 developerConnection
属性中添加用户/密码,如下所示,它可以正常工作。
<scm>
<connection>scm:git:https://user:password@my.company.git.host.com/Project/project.git</connection>
<developerConnection>scm:git:https://user:password@my.company.git.host.com/Project/project.git</developerConnection>
</scm>
这样对吗?我的猜测是发布插件与 https 上的 git 不兼容,但是我会得到一些确认。
最佳答案
我知道这个问题很老,但我现在发现了。调用maven prepare时,可以在命令行参数中设置用户和密码:
mvn release:prepare -DreleaseVersion=1.2 -DdevelopmentVersion=2.0-SNAPSHOT -Dtag=my-tag1.2 -Dusername=YYYYY -Dpassword=XXXXXX
适用于 mavern-release-plugin 2.5.3
问候,
关于git - 通过 HTTPS 将 maven-release-plugin 与 git 结合使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36267995/