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

34 views
Skip to first unread message

ayan0137@uni.sydney.edu.au (JIRA)

unread,
Sep 16, 2019, 6:50:02 AM9/16/19
to jenkinsc...@googlegroups.com
An Yan created an issue
 
Jenkins / Bug JENKINS-59387
Failed to connect to repository : Command "C:\Program Files\Git\cmd\git.exe ls-remote -h — my Repository URL HEAD"
Issue Type: Bug Bug
Assignee: An Yan
Attachments: FireShot Capture 016 - Team15 #1 Console [Jenkins] - localhost.png, FireShot Capture 017 - jenkins-team15 Config [Jenkins] - localhost.png
Components: git-automerger-plugin, git-plugin
Created: 2019-09-16 10:49
Environment: jenkins-2.194
Labels: jenkins git
Priority: Major Major
Reporter: An Yan

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
Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo

ayan0137@uni.sydney.edu.au (JIRA)

unread,
Sep 16, 2019, 7:03:02 AM9/16/19
to jenkinsc...@googlegroups.com

anhhtv.93@gmail.com (JIRA)

unread,
Sep 18, 2019, 10:14:02 PM9/18/19
to jenkinsc...@googlegroups.com

An Yan

I got the same issue as you 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!

anhhtv.93@gmail.com (JIRA)

unread,
Sep 18, 2019, 10:19:03 PM9/18/19
to jenkinsc...@googlegroups.com
Van Anh Hoang edited a comment on Bug JENKINS-59387
[~soft2412]

I got the same issue as
you 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! :D

mark.earl.waite@gmail.com (JIRA)

unread,
Sep 19, 2019, 6:42:05 AM9/19/19
to jenkinsc...@googlegroups.com

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.earl.waite@gmail.com (JIRA)

unread,
Sep 19, 2019, 6:42:06 AM9/19/19
to jenkinsc...@googlegroups.com

mark.earl.waite@gmail.com (JIRA)

unread,
Sep 19, 2019, 6:42:07 AM9/19/19
to jenkinsc...@googlegroups.com

philip.o@jcaelectronics.ca (JIRA)

unread,
Sep 30, 2019, 11:07:03 AM9/30/19
to jenkinsc...@googlegroups.com
Philip O'Gorman commented on Bug JENKINS-59387
 
Re: Failed to connect to repository : Command "C:\Program Files\Git\cmd\git.exe ls-remote -h — my Repository URL HEAD"

I'm seeing this error to - 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@jcaelectronics.ca (JIRA)

unread,
Sep 30, 2019, 11:08:02 AM9/30/19
to jenkinsc...@googlegroups.com
Philip O'Gorman edited a comment on Bug JENKINS-59387
I'm seeing this error to t0o - I've disabled Windows Credential manager:

 
{code:java}

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.
{code}

philip.o@jcaelectronics.ca (JIRA)

unread,
Sep 30, 2019, 11:13:02 AM9/30/19
to jenkinsc...@googlegroups.com
Philip O'Gorman edited a comment on Bug JENKINS-59387
I'm seeing this error t0o too - I've disabled Windows Credential manager:


 
{code:java}
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.
{code}

mark.earl.waite@gmail.com (JIRA)

unread,
Sep 30, 2019, 11:26:03 AM9/30/19
to jenkinsc...@googlegroups.com

Philip O'Gorman 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 it is not this issue. 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.earl.waite@gmail.com (JIRA)

unread,
Sep 30, 2019, 11:27:03 AM9/30/19
to jenkinsc...@googlegroups.com
Mark Waite edited a comment on Bug JENKINS-59387
[~pogorman] the message you're reporting is not the same message as the message that is reported here.  The text in your message:

{noformat}

stderr: remote: Counting objects: 1436, done.
{noformat}

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.earl.waite@gmail.com (JIRA)

unread,
Sep 30, 2019, 11:27:03 AM9/30/19
to jenkinsc...@googlegroups.com
Mark Waite edited a comment on Bug JENKINS-59387
[~pogorman] the message you're reporting is not the same message as the message that is reported here.  The text in your message:

{noformat}
stderr: remote: Counting objects: 1436, done.
{noformat}

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 it is initial authentication and initial connection are not this 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.

philip.o@jcaelectronics.ca (JIRA)

unread,
Sep 30, 2019, 11:31:03 AM9/30/19
to jenkinsc...@googlegroups.com

Mark Waite apologies - I just realised they are not the same - I think the stack trace was similar though, here is the end of the console message:

 

Resolving deltas:  97% (1034/1056)   
Resolving deltas:  98% (1036/1056)   
Resolving deltas:  99% (1054/1056)   
Resolving deltas: 100% (1056/1056)   
Resolving deltas: 100% (1056/1056), done.

	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 org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:124)
	at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:93)
	at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:80)
	at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
	at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
	at java.util.concurrent.FutureTask.run(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)

Should I create a new issue?

 

mark.earl.waite@gmail.com (JIRA)

unread,
Sep 30, 2019, 12:32:03 PM9/30/19
to jenkinsc...@googlegroups.com

Philip O'Gorman Please don't create a new issue until you've explored the question on the Jenkins users mailing list or on the chat channel. The stack trace that you've provided is a strong indication that the problem is specific to your environment. Environment specific questions are best handled in the mailing list or in the chat channels where many more people are watching and many more people are helping.

A bug report only gets the attention of the plugin maintainer. A discussion on the mailing list or in one of the chat channels allows many people that are not maintainers to assist with the question.

For example, in your case, it could be as simple as your repository having grown so large that it needs a longer timeout to complete the clone. It could also be that the workspace has existed for a long enough time with enough incremental updates that it needs a garbage collection from git gc.

philip.o@jcaelectronics.ca (JIRA)

unread,
Sep 30, 2019, 1:16:03 PM9/30/19
to jenkinsc...@googlegroups.com

Thanks Mark - the work around for us is to use ssh instead of http. I'm not really sure whats happening, all of our builds are done from a clean workspace, requiring a full clone. I can clone on the machine using http when I login as the jenkins user. This issue just came up when I updated the latest jenkins and git-client late last week (2.190.12.8.6).  Either way using ssh has fixed the issue

mark.earl.waite@gmail.com (JIRA)

unread,
Sep 30, 2019, 1:27:03 PM9/30/19
to jenkinsc...@googlegroups.com

You may want to check the http logs on the git server to see if there is some indication why it is killing the connection from the Jenkins client that is trying to populate the workspace.

Reply all
Reply to author
Forward
0 new messages