Reputation: 359
I am trying to use the maven release plugin with git over https(for some obscure reason, I can't use git over ssh), however, I am getting receiving the following error message:
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]
Looking over the web, I have figured to set the following properties on my pom.xml file:
<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>
And the following has been added to my settings.xml(located under ~/.m2
folder. I have checked that by running maven with -X
flag)
<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>
Important note:
If I add the user/password directly in connection
and developerConnection
attributes, like bellow, it works properly.
<scm>
<connection>scm:git:https://user:[email protected]/Project/project.git</connection>
<developerConnection>scm:git:https://user:[email protected]/Project/project.git</developerConnection>
</scm>
Is that correct? My guess is that the release plugin is not compatible with git over https however, I'd to get some confirmation about that.
Upvotes: 8
Views: 8389
Reputation: 251
I know this question is very old, but I discover it now. When you call maven prepare, you can set user and password in command line parameter :
mvn release:prepare -DreleaseVersion=1.2 -DdevelopmentVersion=2.0-SNAPSHOT -Dtag=my-tag1.2 -Dusername=YYYYY -Dpassword=XXXXXX
Works with mavern-release-plugin 2.5.3
Regards,
Upvotes: 8
Reputation: 359
After some research, my conclusion is that the release plugin is not able to recover the password from external file when used with an https connection. So the best way I've found is to provide the password along the url, in the following format:
<scm>
<connection>scm:git:https://user:[email protected]/Project/project.git</connection>
<developerConnection>scm:git:https://user:[email protected]/Project/project.git</developerConnection>
</scm>
Upvotes: 3