Maven JGitFlow plugin authentication for HTTPS

12,411

The following JGitFlow Maven plugin configuration works

<plugin>
    <groupId>external.atlassian.jgitflow</groupId>
    <artifactId>jgitflow-maven-plugin</artifactId>
    <version>1.0-m5.1</version>
    <configuration>
        <username>${git.user}</username>
        <password>${git.password}</password>
    </configuration>
</plugin>

Call it from the command line with the username and password as Java System Properties, i.e. with -Dgit.user=<user> and -Dgit.password=<password>, e.g.

mvn [email protected] -Dgit.password=secret jgitflow:release-start

Note: the plugin should really be updated with a Maven CredentialsProvider that is capable of obtaining the credentials from settings.xml and/or a Git credentials parser that uses the same mechanism as git on the command line.

Share:
12,411
Yiftach
Author by

Yiftach

Updated on June 24, 2022

Comments

  • Yiftach
    Yiftach about 2 years

    I'm having trouble authenticating with BitBucket through HTTPS via the Maven JGitFlow plugin, run through git-bash on Windows.

    The error message is: "Authentication is required but no CredentialsProvider has been registered". The suggestions I've seen though seem to assume that I have access to the JGit code itself as a developer.

    I've had no trouble executing git commands directly (I'm using git-credential-winstore). Also, when I've supplied my username and password in the POM explicitly in the pom.xml file, it also worked.

    However, I would not like my password to be uploaded to my BitBucket repository, and am looking for a way for the JGitFlow plugin to authenticate the same way as GIT itself does.

    What am I doing wrong, and how can I fix that?

  • Yiftach
    Yiftach almost 8 years
    This is a clever solution I did not think about. However, would that make everyone who wants to work on my project have to do it as well (even if they use another form of credentials)?
  • Christoffer Soop
    Christoffer Soop almost 8 years
    Yes, each time they use the release plugin they would need to provide credentials. It may be that they are only needed when you connect to the remote repository, I have not tested. Our use case is bungled as we also need to pass the credentials to a proxy...
  • Yiftach
    Yiftach almost 8 years
    While that improves the situation (my credentials will not be shared with the people I collaborate with), that still forces my way of doing things (so it seems not well suited for public repositories, for example).