Skip to content
This repository has been archived by the owner on Oct 5, 2018. It is now read-only.

GitClone fails to pop the awt password box from 0.6.0 up #31

Closed
Cervator opened this issue Aug 24, 2013 · 8 comments
Closed

GitClone fails to pop the awt password box from 0.6.0 up #31

Cervator opened this issue Aug 24, 2013 · 8 comments

Comments

@Cervator
Copy link
Contributor

After lengthy troubleshooting of my issues noted in #30 thinking I had messed up my local dependency cache / SSH setup I finally tried to vary the gradle-git version and my issue went away when using 0.5.0 again :-)

I tossed together a quick example:

import org.ajoberstar.gradle.git.tasks.*

buildscript {
    repositories {
        mavenCentral()
    }

    dependencies {
        classpath 'org.ajoberstar:gradle-git:0.6.0'
    }
}

task testClone(type: GitClone) {
    def org = 'Nanoware'
    def repo = 'Portals'
    def destination = file("$repo")
    enabled = !destination.exists()
    if (enabled) {
        uri = "git@github.com:$org/" + repo + ".git"
        destinationPath = destination
        bare = false
    }
}

That fails for me on my primary system, a clean system (just in case I had messed something up), and on a friend's system with the following error (with --stacktrace on):

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':testClone'.
> Problem with transport.
...
Caused by: org.gradle.api.GradleException: Problem with transport.
...
Caused by: org.eclipse.jgit.api.errors.TransportException: git@github.com:Nanoware/Portals.git: Auth fail
...
Caused by: org.eclipse.jgit.errors.TransportException: git@github.com:Nanoware/Portals.git: Auth fail
...
Caused by: com.jcraft.jsch.JSchException: Auth fail

Normal command line git commands work fine and ask for my passphrase. Going back to 0.5.0 makes it work fine and the awt passphrase prompt pops up.

While digging around I found: http://stackoverflow.com/questions/12502452/how-do-you-set-the-configuration-for-jschconfigsessionfactory-for-jgit-so-that-p/15290861#15290861

But I'm not sure if I'm simply approaching authentication the wrong way after the addition of jsch-agent-proxy support in 0.6.0. Same error in 0.6.2, although at least the new GitInit task works - unsurprisingly since it doesn't auth :-)

I've tried adding the following to no avail:

    credentials {
        password = '[password]'
    }

Thoughts?

@Cervator
Copy link
Contributor Author

Whoops, didn't realize issues would link cross-project :-)

@ajoberstar
Copy link
Owner

Unfortunately, I don't have the best understanding of how JGit's authentication works. I'm thinking the issue might be that the plugin is detecting either ssh-agent or Pageant on your devices and trying to use them, even though you don't have the correct SSH key available.

I'll try a few tests to see if I can recreate the issue. The best solution might be to add a configuration option to hardcode your desired auth method.

@Cervator
Copy link
Contributor Author

I was trying to trigger some alternative authentication option via Gradle, yeah, but was unsure how to. Just including a credentials.password block seemed to get ignored, and I've tried adding those to a gradle.properties in the user home dir before.

I'll circle back around and try some more when I get a chance :-)

@ajoberstar
Copy link
Owner

The credentials block only works when using something like basic auth. It isn't set up to handle SSH keys.

What operating system are you using? Part of the issue seems to be that anytime you are on Windows, it thinks Pageant is available. I'm working on a way to make sure it actually has a key before letting it use the Pageant connector.

I'll also look into options for letting you force it not to use the agent.

@ajoberstar
Copy link
Owner

I think I've fixed the agent selection, so it should work without needing an option to force it.

Can you give this new snapshot a try?

buildscript {
    repositories {
        maven { url 'https://oss.sonatype.org/content/groups/public/' }
    }
    dependencies {
        classpath 'org.ajoberstar:gradle-git:0.6.3-SNAPSHOT'
    }
}

@Cervator
Copy link
Contributor Author

That did it! Works perfectly now :-)

And yep, I'm on Windows. Thank you very much!

@ajoberstar
Copy link
Owner

Good to hear! I'll push out the 0.6.3 release now. Should hit Maven Central in a few hours.

@Cervator
Copy link
Contributor Author

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants