Clone failed transport exception

699 views
Skip to first unread message

Alex Nelson

unread,
Aug 21, 2014, 5:35:33 PM8/21/14
to repo-d...@googlegroups.com
I am trying to import a private repo from github.com to gerrithub.io.

I have imported into gerrithub sucessfully for several other github repos in the same github private organization.

I can view the README.md file on github.com in my browser.
FWIW, that is currently the only file in the repo.

When I try to the import this new repo, I get:  Clone failed transport exception.

I have verified in review.gerrithub.io that my github credentials are fresh.

Any ideas on how to proceed?

thanks,
-Alex

Luca Milanesio

unread,
Aug 21, 2014, 5:56:56 PM8/21/14
to Alex Nelson, repo-d...@googlegroups.com
Hi Alex,
which Git protocol are you using? HTTPS? SSH?

Luca.

--
--
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Alex Nelson

unread,
Aug 21, 2014, 6:01:16 PM8/21/14
to Luca Milanesio, repo-d...@googlegroups.com
I just clicked on the import link using: : https://review.gerrithub.io/plugins/github-plugin/static/repositories.html

In other words, whatever gerrithub.io decided to use.
And yes, I am successfully using my github credentials in gerrithub.io (I made sure to refresh them).
And yes, my ssh keys are the same for both github and gerrithub (they haven't changed, and they've worked before for importing).

I selected my private group,
the only repo that showed up for import was the new one (I've already imported all the other ones).
I checked and clicked "import".
This is the point where I get the error message.

-Alex

Luca Milanesio

unread,
Aug 21, 2014, 6:51:37 PM8/21/14
to Alex Nelson, repo-d...@googlegroups.com
It seems a regression in the JGit library included in the latest Gerrit 2.11-SNAPSHOT taken from master.
(it was working with Gerrit 2.10)

When clone using JGit and HTTP protocol ... it seems to not recognise anymore the HTTP Basic Auth credentials ... and that's why you get then a transport error.

The full error on the logs is:
org.eclipse.jgit.api.errors.TransportException: https://usr...@github.com/organisation/repo.git: not authorized

Will need to dig into the differences of the recent JGit upgrades in Gerrit (3.4.0 and 3.4.1) to see why the basic auth is not taken from the URI anymore.

Luca.

lucamilanesio

unread,
Aug 21, 2014, 8:07:53 PM8/21/14
to repo-d...@googlegroups.com, ane...@vidscale.com
Bingo:

commit a4f560551d291266230b0f20401f62ab826b1315

Author: Alexey Kuznetsov <ax...@me.com>

Date:   Wed Feb 19 02:23:09 2014 +0400


    NetRC parser and credentials provider.

    

    Adds default git command line behaviour of reading credentials

    for https connections from .netrc file.

    

    Bug: 428229

    Change-Id: I88699ca5da6a20bdeaed24b7e3899cc1022b8e7c

    Signed-off-by: Alexey Kuznetsov <ax...@me.com>

    Signed-off-by: Matthias Sohn <matthi...@sap.com>


diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java

index e13bfd3..c4a6bd9 100644

--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java

+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java

@@ -264,6 +264,9 @@ private HttpConfig() {

                }

                http = local.getConfig().get(HTTP_KEY);

                proxySelector = ProxySelector.getDefault();

+

+               if (getCredentialsProvider() == null)

+                       setCredentialsProvider(new NetRCCredentialsProvider());

        }



According HttpAuthMethod:

/**

* Update this method with the credentials from the URIish.

*

* @param uri

*            the URI used to create the connection.

* @param credentialsProvider

*            the credentials provider, or null. If provided,

*            {@link URIish#getPass() credentials in the URI} are ignored.

*

* @return true if the authentication method is able to provide

*         authorization for the given URI

*/

boolean authorize(URIish uri, CredentialsProvider credentialsProvider) {


So in a nutshell ... the "clever idea" to use .netrc as default (even if a ~/.netrc doesn't exist) has basically broken the URIsh username/password basic auth.

Will push a workaround on the GitHub plugin for this.

Luca.
--
--
To unsubscribe, email repo-discuss+unsubscribe@googlegroups.com

More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss+unsubscribe@googlegroups.com.

Luca Milanesio

unread,
Aug 21, 2014, 8:12:36 PM8/21/14
to repo-discuss@googlegroups.com Discussion, Shawn Pearce, Alex Nelson
We need to make sure as well that this ".netrc" thing hasn't broken as well the Gerrit replication over Git/HTTPS authenticated connections.

@Shawn: do you think this can be classified as "regression" in JGit? getCredentialsProvider() would never return null during an HTTP authentication phase (because of the defaulting to NetRCCredentialsProvider) and thus URIish credentials would never be honoured.

Luca.

To unsubscribe, email repo-discuss...@googlegroups.com

More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.

Luca Milanesio

unread,
Aug 22, 2014, 3:13:46 AM8/22/14
to repo-discuss@googlegroups.com Discussion, Shawn Pearce, Alex Nelson
Replication plugins works fine as it uses the com.googlesource.gerrit.plugins.replication.SecureCredentialsProvider ... unfortunately it is *inside* the plugin and cannot be reused in my case :-(

Luca.

lucamilanesio

unread,
Aug 22, 2014, 4:01:30 AM8/22/14
to repo-d...@googlegroups.com, s...@google.com, ane...@vidscale.com
I posted a comment on https://git.eclipse.org/r/#/c/22194/8 ... the change was authored in Feb but actually merged just a few days ago (3rd of August) and the latest updates on Gerrit 2.11 / master pulled this regression in Gerrit.

I am about to upload a patch on GitHub plugin to workaround the situation (only master as Gerrit 2.10 is not impacted).

Luca.

lucamilanesio

unread,
Aug 22, 2014, 4:22:55 AM8/22/14
to repo-d...@googlegroups.com, s...@google.com, ane...@vidscale.com
Workaround has been uploaded to https://gerrit-review.googlesource.com/#/c/59541/ and works fine on https://review.gerrithub.io.
Would be nice to get fixed in JGit though IMHO.

Luca.

Alex Nelson

unread,
Aug 22, 2014, 10:20:33 AM8/22/14
to lucamilanesio, repo-d...@googlegroups.com, s...@google.com
Thank you Luca.   
I can confirm that it works now.
Reply all
Reply to author
Forward
0 new messages