Mikkel Larsen edited a comment on Bug JENKINS-22119

I finally had some time to dig into this.

What caused the problem for me was that when you copy the https address from a private repository on bitbucket it is displayed as:

https://[email protected]/username/repo.git

and for a public repo it is:

https://bitbucket.org/username/repo.git

Removing the `username@` from the url in the jenkins setup, fixes the problem for private repos.

A fix that would allow either format would be to strip the username@ from the url in the `checkCredentials()`: https://github.com/jenkinsci/git-client-plugin/blob/master/src/main/java/org/jenkinsci/plugins/gitclient/CliGitAPIImpl.java#L1854

e.g something like this:

diff --git a/src/main/java/org/jenkinsci/plugins/gitclient/CliGitAPIImpl.java b/src/main/java/org/jenkins
index 9fd48ab..feb95d2 100644
--- a/src/main/java/org/jenkinsci/plugins/gitclient/CliGitAPIImpl.java
+++ b/src/main/java/org/jenkinsci/plugins/gitclient/CliGitAPIImpl.java
@@ -1843,6 +1843,7 @@ public class CliGitAPIImpl extends LegacyCompatibleGitAPIImpl {
      */
     private void checkCredentials(URIish u, StandardCredentials cred) {
         String url = ""
+        url = "" class="code-quote">"[\\w]+@", "");
         final HttpClientBuilder clientBuilder = HttpClients.custom();
         final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
         clientBuilder.setDefaultCredentialsProvider(credentialsProvider);
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira

--
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to