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

"Error cloning remote repo 'origin'" with username:password@bitbucket.org URLs

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Critical Critical
    • None
    • Jenkins 1.598
      Git 1.9.5.msysgit.0

      Using the current version of git-client-plugin 1.15.0 and git-plugin 2.3.4 the cloning of a private bitbucket.org repository does not work.
      It used to work with git-client-plugin 1.3.0 and git-plugin 1.5.0.

      I created a new "Free Style" job, entering only a Git SCM with https://username:password@bitbucket.org/user/repository.git as "Repository URL" leaving everything else as default.
      I'm aware of the credentials functionality, but I need to use https://username:password@bitbucket.org/user/repository.git URL syntax, for otherwise certain post build steps will not work.

      This is the output I get:

      Started by user Flavio Donzé
      Building in workspace C:\data\jenkins\workspace\workspace\git_test
      Cloning the remote Git repository
      Cloning repository https://username:password@bitbucket.org/user/repository.git
      > C:/Progra~2/Git/bin/git.exe init C:\data\jenkins\workspace\workspace\git_test # timeout=10
      Fetching upstream changes from https://username@bitbucket.org/user/repository.git
      > C:/Progra~2/Git/bin/git.exe --version # timeout=10
      > C:/Progra~2/Git/bin/git.exe -c core.askpass=true fetch --tags --progress https://username@bitbucket.org/user/repository.git +refs/heads/:refs/remotes/origin/
      ERROR: Error cloning remote repo 'origin'
      ERROR: Error cloning remote repo 'origin'
      Finished: FAILURE

          [JENKINS-26757] "Error cloning remote repo 'origin'" with username:password@bitbucket.org URLs

          Mark Waite added a comment -

          darenjsmith as far as I can tell from my experiments and the description from flaviodonze and the duplicate bug JENKINS-24368, no amount of retries will allow an https based URL with embedded username and password to work with a private bitbucket (or Stash) repository. While your failure may have similar symptoms (failure cloning the repo), I believe it is a different bug, or it is a configuration issue.

          Mark Waite added a comment - darenjsmith as far as I can tell from my experiments and the description from flaviodonze and the duplicate bug JENKINS-24368 , no amount of retries will allow an https based URL with embedded username and password to work with a private bitbucket (or Stash) repository. While your failure may have similar symptoms (failure cloning the repo), I believe it is a different bug, or it is a configuration issue.

          I'm having the same issue with a GitBlit repository using https. Re-queuing the build resolves the issue each time.
          Jenkins version: 1.619
          GIT client plugin 1.17.1
          GIT plugin 2.3.5
          Git Version 1.9.5-preview20150319

          Lieven Cardoen added a comment - I'm having the same issue with a GitBlit repository using https. Re-queuing the build resolves the issue each time. Jenkins version: 1.619 GIT client plugin 1.17.1 GIT plugin 2.3.5 Git Version 1.9.5-preview20150319

          Code changed in jenkins
          User: Mark Waite
          Path:
          src/test/java/org/jenkinsci/plugins/gitclient/CredentialsTest.java
          http://jenkins-ci.org/commit/git-client-plugin/ff9c219277531dcf0f18dccd6d8665118e1827a3
          Log:
          Add username/password support to CredentialsTest

          Help test JENKINS-26757, JENKINS-24368 and JENKINS-28460.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Mark Waite Path: src/test/java/org/jenkinsci/plugins/gitclient/CredentialsTest.java http://jenkins-ci.org/commit/git-client-plugin/ff9c219277531dcf0f18dccd6d8665118e1827a3 Log: Add username/password support to CredentialsTest Help test JENKINS-26757 , JENKINS-24368 and JENKINS-28460 .

          Mark Waite added a comment - - edited

          As far as I can tell from testing the most recent git client plugin (pre-release of 1.18.1) and the Jenkins 1.609.2 RC build, this is resolved for https://username:password@bitbucket.org/ private repositories. I believe Jacob Keller's recent submission has fixed this.

          Bitbucket private repositories with ssh access still don't seem to work with username and password using that pre-release version.

          Mark Waite added a comment - - edited As far as I can tell from testing the most recent git client plugin (pre-release of 1.18.1) and the Jenkins 1.609.2 RC build, this is resolved for https://username:password@bitbucket.org/ private repositories. I believe Jacob Keller's recent submission has fixed this. Bitbucket private repositories with ssh access still don't seem to work with username and password using that pre-release version.

          Mark Waite added a comment -

          Failed check. I had run that test interactively and thought it worked. An automated test is definitely working in my test harness. Unfortunately, when I just attempted the same thing from a fresh docker instance of Jenkins using https://username:password@bitbucket.org/username/private-repo.git, it failed. I then used the same repository URL from command line git and confirmed it works correctly.

          The automated test must not be matching the real world closely enough. I'll explore further as time allows.

          Mark Waite added a comment - Failed check. I had run that test interactively and thought it worked. An automated test is definitely working in my test harness. Unfortunately, when I just attempted the same thing from a fresh docker instance of Jenkins using https://username:password@bitbucket.org/username/private-repo.git , it failed. I then used the same repository URL from command line git and confirmed it works correctly. The automated test must not be matching the real world closely enough. I'll explore further as time allows.

          Paulo Moreira added a comment -

          Hello All,

          Also facing this error:

          > D:\Programs\Git\cmd\git.exe -c core.askpass=true fetch --tags --progress ssh://*******.git +refs/heads/:refs/remotes/origin/*
          ERROR: Error cloning remote repo 'origin'
          hudson.plugins.git.GitException: Command "D:\Programs\Git\cmd\git.exe -c core.askpass=true fetch --tags --progress ssh://************.git +refs/heads/:refs/remotes/origin/*" returned status code 128:
          stdout:
          stderr: plink: unknown option "-o"
          plink: unknown option "-p"
          fatal: Could not read from remote repository.


          Please note: under Execute Windows batch command its OK
          It only fails under GIT Plugin (Source Code Management)

          This runs as slave:
          GIT client plugin: 1.19.0
          Git plugin: 2.4.0
          Jenkins: v1.639

          Best Regards,
          Paulo

          Paulo Moreira added a comment - Hello All, Also facing this error: > D:\Programs\Git\cmd\git.exe -c core.askpass=true fetch --tags --progress ssh://******* .git +refs/heads/ :refs/remotes/origin/* ERROR: Error cloning remote repo 'origin' hudson.plugins.git.GitException: Command "D:\Programs\Git\cmd\git.exe -c core.askpass=true fetch --tags --progress ssh://************ .git +refs/heads/ :refs/remotes/origin/*" returned status code 128: stdout: stderr: plink: unknown option "-o" plink: unknown option "-p" fatal: Could not read from remote repository. Please note: under Execute Windows batch command its OK It only fails under GIT Plugin (Source Code Management) This runs as slave: GIT client plugin: 1.19.0 Git plugin: 2.4.0 Jenkins: v1.639 Best Regards, Paulo

          Mark Waite added a comment -

          Paulo, can't you use a Jenkins managed credential which includes your bitbucket username and password? Then you don't need to embed the username and password in the URL, instead you let Jenkins keep the username and password better hidden.

          Mark Waite added a comment - Paulo, can't you use a Jenkins managed credential which includes your bitbucket username and password? Then you don't need to embed the username and password in the URL, instead you let Jenkins keep the username and password better hidden.

          Paulo Moreira added a comment -

          Hi Mark, a am using the Jenkins managed credential, I didnt show the URL because its an internal URL. Therefore I don´t use the username and pass in the URL.
          Thanks any way

          Paulo Moreira added a comment - Hi Mark, a am using the Jenkins managed credential, I didnt show the URL because its an internal URL. Therefore I don´t use the username and pass in the URL. Thanks any way

          Mark Waite added a comment -

          If you're using a Jenkins managed credential, and you're using ssh protocol, then that is unrelated to this bug report. This bug requires that you are using http or https and that the username and password are embedded in the URL, not as a Jenkins managed credential.

          I've never found a way to use username and password with an ssh protocol. I always need to use a private key for ssh protocol.

          I've never found a way to use a private key with https protocol. I always need to use username and password for https protocol.

          Mark Waite added a comment - If you're using a Jenkins managed credential, and you're using ssh protocol, then that is unrelated to this bug report. This bug requires that you are using http or https and that the username and password are embedded in the URL, not as a Jenkins managed credential. I've never found a way to use username and password with an ssh protocol. I always need to use a private key for ssh protocol. I've never found a way to use a private key with https protocol. I always need to use username and password for https protocol.

          Flavio Donzé added a comment -

          I just updated to Jenkins 2.0 Release Candidate. In the same move I updated "Git plugin" to version 2.4.4 and "Git client plugin" to version 1.19.6.
          In this constellation the error does not occur anymore and the sources are cloned as expected.

          Flavio Donzé added a comment - I just updated to Jenkins 2.0 Release Candidate. In the same move I updated "Git plugin" to version 2.4.4 and "Git client plugin" to version 1.19.6. In this constellation the error does not occur anymore and the sources are cloned as expected.

            Unassigned Unassigned
            flaviodonze Flavio Donzé
            Votes:
            4 Vote for this issue
            Watchers:
            12 Start watching this issue

              Created:
              Updated:
              Resolved: