Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-24368

Authentication failed for https://username@bitbucket.org/project/repository.git

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • git-client-plugin
    • None
    • git client plugin 3.6.0

      Getting the following error after updating
      GIT plugin: 1.5.0 > 2.2.5
      GIT client plugin: 1.3.0 > 1.10.1

      ERROR: Error cloning remote repo 'origin'
      hudson.plugins.git.GitException: Command "C:/Progra~2/Git/bin/git.exe fetch --tags --progress https://username@bitbucket.org/project/repository.git +refs/heads/:refs/remotes/origin/" returned status code 128:
      stdout:
      stderr: fatal: Authentication failed for 'https://username@bitbucket.org/project/repository.git/'

      at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1407)
      at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1195)
      at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$200(CliGitAPIImpl.java:87)
      at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:266)
      at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:422)
      at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:857)
      at hudson.plugins.git.GitSCM.checkout(GitSCM.java:890)
      at org.jenkinsci.plugins.multiplescms.MultiSCM.checkout(MultiSCM.java:118)
      at hudson.model.AbstractProject.checkout(AbstractProject.java:1255)
      at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:624)
      at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
      at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:530)
      at hudson.model.Run.execute(Run.java:1740)
      at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
      at hudson.model.ResourceController.execute(ResourceController.java:88)
      at hudson.model.Executor.run(Executor.java:233)

          [JENKINS-24368] Authentication failed for https://username@bitbucket.org/project/repository.git

          Flavio Donzé created issue -

          Mark Waite added a comment - - edited

          I believe you'll need to switch from using the https://username@bitbucket.org/ syntax to use a credential defined through "Manage Credentials" and the https://bitbucket.org/ syntax (without the username@ part).

          Mark Waite added a comment - - edited I believe you'll need to switch from using the https://username@bitbucket.org/ syntax to use a credential defined through "Manage Credentials" and the https://bitbucket.org/ syntax (without the username@ part).

          Flavio Donzé added a comment -

          Thanks for this workaround, but I need to use the username@host syntax.

          Flavio Donzé added a comment - Thanks for this workaround, but I need to use the username@host syntax.

          Dhwani Shah added a comment - - edited

          I am also getting the same issue in version 1.576. What should i do to connect with the bitbucket repository in the latest version?

          Dhwani Shah added a comment - - edited I am also getting the same issue in version 1.576. What should i do to connect with the bitbucket repository in the latest version?

          Mark Waite added a comment -

          My technique was to define a credential through the "Manage Credentials" page in Jenkins administration, then reference that credential in the job definition and remove the "username@" portion from the https URL.

          Mark Waite added a comment - My technique was to define a credential through the "Manage Credentials" page in Jenkins administration, then reference that credential in the job definition and remove the "username@" portion from the https URL.
          Mark Waite made changes -
          Component/s Original: git [ 15543 ]

          Mark Waite added a comment - - edited

          I've found bitbucket authentication somewhat surprising and have described some of the interactions between private vs. public repositories and ssh vs. https URLs in JENKINS-24368. Unfortunately, all those investigations confirmed that I don't know how to access a private https based bitbucket git repository from the git plugin with either username / password or public key.

          I can access a public https bitbucket git repository with username/password credentials.

          I can access a public or a private ssh bitbucket git repository with public key credentials.

          Mark Waite added a comment - - edited I've found bitbucket authentication somewhat surprising and have described some of the interactions between private vs. public repositories and ssh vs. https URLs in JENKINS-24368 . Unfortunately, all those investigations confirmed that I don't know how to access a private https based bitbucket git repository from the git plugin with either username / password or public key. I can access a public https bitbucket git repository with username/password credentials. I can access a public or a private ssh bitbucket git repository with public key credentials.
          Mark Waite made changes -
          Link New: This issue is related to JENKINS-22694 [ JENKINS-22694 ]

          Mark Waite added a comment - - edited

          The git-client-plugin 1.14.0 change to remove the call to JGit implementation of checkCredentials resolved this issue for me. I can clone from https://markewaite@bitbucket.org/markewaite/bin.git, a private bitbucket repository using stored credentials as reported in JENKINS-22694.

          With git plugin 2.3.5 and git client plugin 1.16.1, I cannot access a private bitbucket repository when the user name and password are embedded in the https URL. Refer to JENKINS-26757 for what appears to be a duplicate report.

          Mark Waite added a comment - - edited The git-client-plugin 1.14.0 change to remove the call to JGit implementation of checkCredentials resolved this issue for me. I can clone from https://markewaite@bitbucket.org/markewaite/bin.git , a private bitbucket repository using stored credentials as reported in JENKINS-22694 . With git plugin 2.3.5 and git client plugin 1.16.1, I cannot access a private bitbucket repository when the user name and password are embedded in the https URL. Refer to JENKINS-26757 for what appears to be a duplicate report.
          Mark Waite made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: Open [ 1 ] New: Resolved [ 5 ]

            Unassigned Unassigned
            flaviodonze Flavio Donzé
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: