[JIRA] (JENKINS-50573) Wrong username used for git clone with OpenSSH 7.7

17 views
Skip to first unread message

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

unread,
Jul 19, 2018, 7:16:05 PM7/19/18
to jenkinsc...@googlegroups.com
Mark Waite updated an issue
 
Jenkins / Bug JENKINS-50573
Wrong username used for git clone with OpenSSH 7.7
Change By: Mark Waite
Summary: Wrong username used for git clone with Git 2.17 on Windows and OpenSSH 7.7
Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.10.1#710002-sha1:6efc396)

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

unread,
Jul 19, 2018, 7:17:04 PM7/19/18
to jenkinsc...@googlegroups.com
Mark Waite updated an issue
Windows VMs and , Alpine Linux docker images , and OpenBSD 6.3 installations which use OpenSSH 7.7 (on Windows as part of the Git on Windows 2.17 and Git on Windows 2.18) use the wrong username when cloning git repos. They're using {{jenkins}} when {{git}} is explicitly specified.
{code:java}
dir("dist-utils") {
    git credentialsId: 'ssh-id-rsa', url: 'ssh://g...@github.com/zeroc-ice/dist-utils.git'
}{code}
{code:java}
> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url ssh://g...@github.com/zeroc-ice/dist-utils.git # timeout=10
Fetching upstream changes from ssh://g...@github.com/zeroc-ice/dist-utils.git
> git --version # timeout=10
using GIT_SSH to set credentials Jenkins SSH RSA Key
> git fetch --tags --progress ssh://g...@github.com/zeroc-ice/dist-utils.git +refs/heads/*:refs/remotes/origin/*
ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from ssh://g...@github.com/zeroc-ice/dist-utils.git
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:862)
at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1129)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1160)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:113)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:85)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:75)
at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47)
at hudson.security.ACL.impersonate(ACL.java:290)
at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:44)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: hudson.plugins.git.GitException: Command "git fetch --tags --progress ssh://g...@github.com/zeroc-ice/dist-utils.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout:
stderr: jen...@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1996)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1715)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:72)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:405)
at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:153)
at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:146)
at hudson.remoting.UserRequest.perform(UserRequest.java:210)
at hudson.remoting.UserRequest.perform(UserRequest.java:53)
at hudson.remoting.Request$2.run(Request.java:364)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
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 hudson.remoting.Engine$1$1.run(Engine.java:94)
at java.lang.Thread.run(Unknown Source)
Suppressed: hudson.remoting.Channel$CallSiteStackTrace: Remote call to JNLP4-connect connection from sal.testing.zeroc.com/192.168.90.21:58772
  at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1737)
  at hudson.remoting.UserResponse.retrieve(UserRequest.java:313)
  at hudson.remoting.Channel.call(Channel.java:952)
  at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.execute(RemoteGitImpl.java:146)
  at sun.reflect.GeneratedMethodAccessor700.invoke(Unknown Source)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:498)
  at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.invoke(RemoteGitImpl.java:132)
  at com.sun.proxy.$Proxy96.execute(Unknown Source)
  at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:860)
  at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1129)
  at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1160)
  at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:113)
  at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:85)
  at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:75)
  at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47)
  at hudson.security.ACL.impersonate(ACL.java:290)
  at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:44)
  at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
  at java.util.concurrent.FutureTask.run(FutureTask.java:266)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
  at java.lang.Thread.run(Thread.java:748){code}
Note, most importantly,
{code:java}
stderr: jen...@github.com: Permission denied (publickey).{code}
Running a git clone manually using an ssh agent works fine:
{code:java}
sshagent(credentials: ['ssh-id-rsa']) {
  bat "git clone g...@github.com:zeroc-ice/dist-utils.git dist-utils"
}{code}

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

unread,
Jul 19, 2018, 7:17:06 PM7/19/18
to jenkinsc...@googlegroups.com
Mark Waite updated an issue
Windows VMs, Alpine Linux docker images, Debian Buster ("testing"), and OpenBSD 6.3 installations which use OpenSSH 7.7 (on Windows as part of the Git on Windows 2.17 and Git on Windows 2.18) use the wrong username when cloning git repos. They're using {{jenkins}} when {{git}} is explicitly specified.

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

unread,
Jul 19, 2018, 7:22:02 PM7/19/18
to jenkinsc...@googlegroups.com
Mark Waite updated an issue
Windows VMs, Alpine Linux docker images, Debian Buster ("testing"), and OpenBSD 6.3 installations which use OpenSSH 7.7 (on Windows as part of the Git on Windows 2.17 and Git on Windows 2.18) use the wrong username when cloning git repos with ssh (private key authentication) . They're using {{jenkins}} when {{git}} is explicitly specified.

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

unread,
Jul 19, 2018, 7:23:03 PM7/19/18
to jenkinsc...@googlegroups.com
Mark Waite updated an issue
Windows VMs, Alpine Linux docker images, Debian Buster ("testing"), and OpenBSD 6.3 installations which use OpenSSH 7.7 (on Windows as part of the Git on Windows 2.17 and Git on Windows 2.18) use the wrong username when cloning git repos with ssh (private key authentication). They're using {{jenkins}} when {{git}} is explicitly specified.


Work arounds include:

* Switch the username in the private key credential from the "actual user" to "git" (for example, instead of "MarkEWaite", use "git" as the credential username)
* Switch to use username/password with https rather than a private key credential
* Switch to use JGit as the git implementation for affected Jenkins jobs instead of command line git

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

unread,
Jul 19, 2018, 7:24:03 PM7/19/18
to jenkinsc...@googlegroups.com
Work arounds Workarounds include:


* Switch the username in the private key credential from the "actual user" to "git" (for example, instead of "MarkEWaite", use "git" as the credential username)
* Switch to use username/password with https rather than a private key credential
* Switch to use JGit as the git implementation for affected Jenkins jobs instead of command line git

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

unread,
Jul 19, 2018, 10:22:02 PM7/19/18
to jenkinsc...@googlegroups.com
Git on Windows 2.17 and Git on Windows 2.18) use the wrong username when cloning git repos with ssh (private key authentication). They're using {{jenkins}} when {{git}} is explicitly specified.
Workarounds include:

* Switch the username in the private key credential from the "actual user" to "git" (for example, instead of "MarkEWaite", use "git" as the credential username)
* Switch to use username/password with https rather than a private key credential
* Switch to use JGit as the git implementation for affected Jenkins jobs instead of command line git

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

unread,
Jul 19, 2018, 10:44:02 PM7/19/18
to jenkinsc...@googlegroups.com
Mark Waite updated an issue
Windows VMs, Alpine Linux docker images, Debian Buster ("testing"), and OpenBSD 6.3 installations which use OpenSSH 7.7 (on Windows as part of Git on Windows 2.17 and Git on Windows 2.18) use the wrong username when cloning git repos with ssh (private key authentication). They're using {{jenkins}} when {{git}} is explicitly specified.
h3. Workarounds include:


* Switch the username in the private key credential from the "actual user" to "git" (for example, instead of "MarkEWaite", use "git" as the credential username)
* Switch to use username/password with https rather than a private key credential
* Switch to use JGit as the git implementation for affected Jenkins jobs instead of command line git

jonathan@riv.al (JIRA)

unread,
Jul 20, 2018, 10:46:01 AM7/20/18
to jenkinsc...@googlegroups.com
Jonathan B commented on Bug JENKINS-50573
 
Re: Wrong username used for git clone with OpenSSH 7.7

Mark Waite thank you very much for confirming that you see still the issue. The lightweight checkout workaround worked in my case.

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

unread,
Jul 20, 2018, 11:40:02 AM7/20/18
to jenkinsc...@googlegroups.com
Mark Waite updated an issue
Change By: Mark Waite

* Use a different version of OpenSSH (7.6 or earlier)

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

unread,
Jul 23, 2018, 8:30:02 PM7/23/18
to jenkinsc...@googlegroups.com

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

unread,
Jul 23, 2018, 8:30:04 PM7/23/18
to jenkinsc...@googlegroups.com
Mark Waite started work on Bug JENKINS-50573
 
Change By: Mark Waite
Status: Open In Progress

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

unread,
Jul 23, 2018, 9:44:02 PM7/23/18
to jenkinsc...@googlegroups.com
Mark Waite commented on Bug JENKINS-50573
 
Re: Wrong username used for git clone with OpenSSH 7.7

Jonathan B a [git client plugin 2.7.3 pre-release buildhttps://ci.jenkins.io/job/Plugins/job/git-client-plugin/job/PR-337/1/artifact/target/git-client.hpi] is available. Would you be willing to test it in your environment? I'm running it in mine and have confirmed it resolves the issue.

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

unread,
Jul 23, 2018, 9:52:02 PM7/23/18
to jenkinsc...@googlegroups.com
Mark Waite edited a comment on Bug JENKINS-50573
[~jonathanb1] a [git client plugin 2.7.3 pre-release buildhttps build|https ://ci.jenkins.io/job/Plugins/job/git-client-plugin/job/PR-337/1/artifact/target/git-client.hpi] is available.  Would you be willing to test it in your environment?  I'm running it in mine and have confirmed it resolves the issue.

nolange79@gmail.com (JIRA)

unread,
Jul 24, 2018, 8:11:02 AM7/24/18
to jenkinsc...@googlegroups.com

Hello, I did a quick test with the new version, and it solves the issue on my installation (docker with jenkins/jenkins:2.121.2-alpine). Thanks

jonathan@riv.al (JIRA)

unread,
Jul 24, 2018, 10:44:01 AM7/24/18
to jenkinsc...@googlegroups.com

This pre-release build also looks good on my end. Thanks!

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

unread,
Jul 24, 2018, 2:44:04 PM7/24/18
to jenkinsc...@googlegroups.com
Mark Waite resolved as Fixed
 

Included in git client plugin 2.7.3 and git client plugin 3.0.0-beta4 released 24 July 2018.

Change By: Mark Waite
Status: In Progress Resolved
Resolution: Fixed

owen@nerdnetworks.org (JIRA)

unread,
Jan 9, 2019, 9:46:02 PM1/9/19
to jenkinsc...@googlegroups.com
Owen Mehegan commented on Bug JENKINS-50573
 
Re: Wrong username used for git clone with OpenSSH 7.7

I just wanted to add that MacOS 10.13.6 is also affected by this. It includes OpenSSH 7.8. Updating git-client fixes the problem on those hosts.

This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

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

unread,
Jan 9, 2019, 10:35:04 PM1/9/19
to jenkinsc...@googlegroups.com
Mark Waite updated an issue
Change By: Mark Waite
Windows VMs, Alpine Linux docker images, Debian Buster ("testing"), macOS 10.13.6, and OpenBSD 6.3 installations which use OpenSSH 7.7 (on Windows as part of Git on Windows 2.17 and Git on Windows 2.18) use the wrong username when cloning git repos with ssh (private key authentication). They're using {{jenkins}} when {{git}} is explicitly specified.

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

unread,
Oct 17, 2019, 9:26:02 AM10/17/19
to jenkinsc...@googlegroups.com
Mark Waite closed an issue as Fixed
Change By: Mark Waite
Status: Resolved Closed
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages