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

Failed to connect to repository : Command "C:\Program Files\Git\cmd\git.exe ls-remote -h — my Repository URL HEAD"

      When I I copy my Private project link to Jenkins, I get some error like this:

      Failed to connect to repository : Command "C:\Program Files\Git\cmd\git.exe ls-remote -h -- https://github.sydney.edu.au/SOFT2412-2019S2/WBYWJD_WYWJD_Team15.git HEAD" returned status code 128:
      stdout:
      stderr: Logon failed, use ctrl+c to cancel basic credential prompt.
      error: cannot spawn C:\WINDOWS\TEMP\pass6522988368209337473.bat: No error
      fatal: could not read Username for 'https://github.sydney.edu.au': terminal prompts disabled

      And when I try to build something there, the log of Confirmation failure is like that.

      Started by GitHub push by zzho0631
      Running as SYSTEM
      Building in workspace C:\Program Files (x86)\Jenkins\workspace\Team15
      using credential ec3b9de9-638a-472d-a137-668b7c1744f8
      Cloning the remote Git repository
      Cloning repository https://github.sydney.edu.au/SOFT2412-2019S2/WBYWJD_WYWJD_Team15.git
       > git.exe init C:\Program Files (x86)\Jenkins\workspace\Team15 # timeout=10
      Fetching upstream changes from https://github.sydney.edu.au/SOFT2412-2019S2/WBYWJD_WYWJD_Team15.git
       > git.exe --version # timeout=10
      using GIT_ASKPASS to set credentials 
       > git.exe fetch --tags --force --progress -- https://github.sydney.edu.au/SOFT2412-2019S2/WBYWJD_WYWJD_Team15.git +refs/heads/*:refs/remotes/origin/*
      ERROR: Error cloning remote repo 'origin'
      hudson.plugins.git.GitException: Command "git.exe fetch --tags --force --progress -- https://github.sydney.edu.au/SOFT2412-2019S2/WBYWJD_WYWJD_Team15.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
      stdout: 
      stderr: Logon failed, use ctrl+c to cancel basic credential prompt.
      error: cannot spawn C:\WINDOWS\TEMP\pass2346010482442283795.bat: No error
      fatal: could not read Username for 'https://github.sydney.edu.au': terminal prompts disabled
      
          at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2172)
          at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1864)
          at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$500(CliGitAPIImpl.java:78)
          at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:545)
          at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:758)
          at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1152)
          at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1192)
          at hudson.scm.SCM.checkout(SCM.java:504)
          at hudson.model.AbstractProject.checkout(AbstractProject.java:1206)
          at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:574)
          at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
          at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:499)
          at hudson.model.Run.execute(Run.java:1815)
          at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
          at hudson.model.ResourceController.execute(ResourceController.java:97)
          at hudson.model.Executor.run(Executor.java:429)
      ERROR: Error cloning remote repo 'origin'
      Finished: FAILURE
      

          [JENKINS-59387] Failed to connect to repository : Command "C:\Program Files\Git\cmd\git.exe ls-remote -h — my Repository URL HEAD"

          An Yan created issue -
          An Yan made changes -
          Rank New: Ranked higher
          An Yan made changes -
          Rank New: Ranked higher

          An Yan added a comment -

          Does anyone know how to slove this problem, i am gonna crazy

          An Yan added a comment - Does anyone know how to slove this problem, i am gonna crazy

          Van Anh Hoang added a comment - - edited

          soft2412

          I got the same issue as yours when I change the password and delete all data at Credential Manager>Windows Credentials.

          Solution:

          1. Delete tenant.cache from AppData/Local/GitCredentialManager

          2. Edit "git:https://" prefixed entries from Credentials Manager>Windows Credentials with new password

          OR

          Delete all credentials with "git:https://" prefixed entries from Credentials Manager>Windows Credentials and then clone git project by command line to login with window credential prompt.

          3. Build Jenkins job again. Done!

          Van Anh Hoang added a comment - - edited soft2412 I got the same issue as yours when I change the password and delete all data at Credential Manager>Windows Credentials. Solution: 1. Delete tenant.cache from AppData/Local/GitCredentialManager 2. Edit "git:https://" prefixed entries from Credentials Manager>Windows Credentials with new password OR Delete all credentials with "git:https://" prefixed entries from Credentials Manager>Windows Credentials and then clone git project by command line to login with window credential prompt. 3. Build Jenkins job again. Done!

          Mark Waite added a comment -

          The git client plugin documentation recommends that you disable the credential manager that git for Windows offers to install by default. The Windows credential manager is a great help for interactive users. It can be a great distraction for automation use cases like Jenkins.

          Please don't use the bug tracker to request help. The user mailing list and the chat system are better places to request help with configuration problems.

          Mark Waite added a comment - The git client plugin documentation recommends that you disable the credential manager that git for Windows offers to install by default. The Windows credential manager is a great help for interactive users. It can be a great distraction for automation use cases like Jenkins. Please don't use the bug tracker to request help. The user mailing list and the chat system are better places to request help with configuration problems.
          Mark Waite made changes -
          Resolution New: Not A Defect [ 7 ]
          Status Original: Open [ 1 ] New: Fixed but Unreleased [ 10203 ]
          Mark Waite made changes -
          Status Original: Fixed but Unreleased [ 10203 ] New: Closed [ 6 ]

          Philip O'Gorman added a comment - - edited

          I'm seeing this error too - I've disabled Windows Credential manager:

           

          using credential ea2a4045-c112-445c-8b6c-57c20e5a8699
          Cloning the remote Git repository
          Cloning with configured refspecs honoured and without tags
          Cloning repository https://myurl.git
           > git.exe init E:\wp\ler-multibranch-pipeline_develop # timeout=10
          Fetching upstream changes from https://myurl.git
           > git.exe --version # timeout=10
          using GIT_ASKPASS to set credentials Bitbucket login for jenkins
           > git.exe fetch --no-tags --progress -- https://myurl.git +refs/heads/*:refs/remotes/origin/*
          ERROR: Error cloning remote repo 'origin'
          hudson.plugins.git.GitException: Command "git.exe fetch --no-tags --progress -- https://myurl.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
          stdout: 
          stderr: remote: Counting objects: 1436, done.
          

          Philip O'Gorman added a comment - - edited I'm seeing this error too - I've disabled Windows Credential manager:   using credential ea2a4045-c112-445c-8b6c-57c20e5a8699 Cloning the remote Git repository Cloning with configured refspecs honoured and without tags Cloning repository https: //myurl.git > git.exe init E:\wp\ler-multibranch-pipeline_develop # timeout=10 Fetching upstream changes from https: //myurl.git > git.exe --version # timeout=10 using GIT_ASKPASS to set credentials Bitbucket login for jenkins > git.exe fetch --no-tags --progress -- https: //myurl.git +refs/heads/*:refs/remotes/origin/* ERROR: Error cloning remote repo 'origin' hudson.plugins.git.GitException: Command "git.exe fetch --no-tags --progress -- https: //myurl.git +refs/heads/*:refs/remotes/origin/*" returned status code 128: stdout: stderr: remote: Counting objects: 1436, done.

          Mark Waite added a comment - - edited

          pogorman the message you're reporting is not the same message as the message that is reported here. The text in your message:

          stderr: remote: Counting objects: 1436, done.
          

          indicates that command line git successfully authenticated to the remote git server, requested data, and received data. The reason for the failure is not clear in the log output you included, but it is sufficient to show that initial authentication and initial connection are not the issue you are seeing.

          I suspect a configuration issue in your case, or an issue that your remote git server has chosen to close the connection after the authentication was successful and data was transferred.

          The original message reported in this bug report was not able to authenticate to the remote server.

          Mark Waite added a comment - - edited pogorman the message you're reporting is not the same message as the message that is reported here. The text in your message: stderr: remote: Counting objects: 1436, done. indicates that command line git successfully authenticated to the remote git server, requested data, and received data. The reason for the failure is not clear in the log output you included, but it is sufficient to show that initial authentication and initial connection are not the issue you are seeing. I suspect a configuration issue in your case, or an issue that your remote git server has chosen to close the connection after the authentication was successful and data was transferred. The original message reported in this bug report was not able to authenticate to the remote server.

            Unassigned Unassigned
            soft2412 An Yan
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: