mschonaker / wagon-git

Git Wagon for Apache Maven
http://synergian.github.io/wagon-git/
83 stars 31 forks source link

HTTPS Git credentials aren't filled from Maven settings #42

Open nickcmaynard opened 7 years ago

nickcmaynard commented 7 years ago

We're attempting to do the following:

    <repository>
      <id>maven-releases</id>
      <name>My Maven Repo</name>
      <url>git:releases://https://github.com/username/repo.git</url>
    </repository>

Yep - that's an HTTPS URL. If the HTTPS Git credentials are cached by Git, then everything works very well.

Sadly, in a CI environment (like Jenkins) we don't have the ability to manipulate the Git credentials cache - at which point the user (Jenkins) is asked for the username and password.

And this, obviously, fails the build.

Now, having set up the username and password in the Maven settings, the information is available to Maven. Unfortunately, this plugin doesn't use the information.

Sadly we can't do the obvious thing and use SSH. We're on a managed Jenkins instance, and don't have access to underlying filesystem. Incidentally, the same reason we can't pre-seed git-credentials with the information.

Does anyone have any ideas?

mschonaker commented 7 years ago

Have you already tried .netrc file? It happens that wagon-git uses gitexe provider which, in turn, uses the git client installed in your system. That's why I'd give it a try.

Regards.

On Sep 26, 2016 14:16, "Nick Maynard" notifications@github.com wrote:

We're attempting to do the following:

<repository>
  <id>maven-releases</id>
  <name>My Maven Repo</name>
  <url>git:releases://https://github.com/username/repo.git</url>
</repository>

Yep - that's an HTTPS URL. If the HTTPS Git credentials are cached by Git, then everything works very well.

Sadly, in a CI environment (like Jenkins) we don't have the ability to manipulate the Git credentials cache - at which point the user (Jenkins) is asked for the username and password.

And this, obviously, fails the build.

Now, having set up the username and password in the Maven settings, the information is available to Maven. Unfortunately, this plugin doesn't use the information.

We can't do the obvious thing and use SSH because, we're on a managed Jenkins instance, and don't have access to underlying filesystem/credential storage.

Does anyone have any ideas?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/synergian/wagon-git/issues/42, or mute the thread https://github.com/notifications/unsubscribe-auth/AAWESYWX82eTuJV524j9V1iaq-vCWDt6ks5qt_3-gaJpZM4KGxiy .

nickcmaynard commented 7 years ago

Hey, thanks for getting back to me. For the same reason as we can't update the .ssh/ directory, or pre-seed git credentials, we don't have access to .netrc.

nickcmaynard commented 7 years ago

I did notice the concept of a Git credentials provider, along with the GIT_ASKPASS environment variable... but that would, I think, involve code on the part of this plugin.

mschonaker commented 7 years ago

Have you tried providing the user and password in the URL? Just like in this SO answer.

nickcmaynard commented 7 years ago

While that may work, it's undesirable as we then bake credentials into the POM. Each of our developers has individual creds, and we have many POMs... We'd then need to make sure they were stripped before committing the POM to source control...

You get the idea. Sadly we can't run with that.

tuxedo0801 commented 5 years ago

I have exactly the same issue. Tried the same with bitbucket repo with http access. The documentation says, that one can set private access credentials in settings.xml: http://synergian.github.io/wagon-git/bitbucket.html

I checked the source-code. I can't see any access to maven settings.xml :-( @mschonaker How does this work?