【问题标题】:Git authentication failing on jenkins with hudson after upgrading to Mojave升级到 Mojave 后,使用 hudson 对 jenkins 进行 Git 身份验证失败
【发布时间】:2019-04-16 21:39:15
【问题描述】:

我们的 CI (Jenkins) 之前使用标准主从配置在 High Sierra 上工作,主从配置在构建时向从属提供 ssh 凭据。升级到 mojave 后,我们所有的构建都失败并显示以下消息:

21:29:33 Fetching changes from the remote Git repository
21:29:33  > git config remote.origin.url git@github.com:myrepo/ios.git # timeout=10
21:29:33 Pruning obsolete local branches
21:29:34 Fetching upstream changes from git@github.myrepo/ios.git
21:29:34  > git --version # timeout=10
21:29:34 using GIT_SSH to set credentials For use with GitHub
21:29:34  > git -c core.askpass=true fetch --tags --progress git@github.com:myrepo/ios.git +refs/heads/master:refs/remotes/origin/master --prune # timeout=30
21:29:34 ERROR: Error fetching remote repo 'origin'
21:29:34 hudson.plugins.git.GitException: Failed to fetch from git@github.com:myrepo/ios.git
21:29:34    at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:766)
21:29:34    at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1022)
21:29:34    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1053)
21:29:34    at hudson.scm.SCM.checkout(SCM.java:485)
21:29:34    at hudson.model.AbstractProject.checkout(AbstractProject.java:1269)
21:29:34    at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:607)
21:29:34    at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
21:29:34    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:529)
21:29:34    at hudson.model.Run.execute(Run.java:1738)
21:29:34    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
21:29:34    at hudson.model.ResourceController.execute(ResourceController.java:98)
21:29:34    at hudson.model.Executor.run(Executor.java:410)
21:29:34 Caused by: hudson.plugins.git.GitException: Command "git -c core.askpass=true fetch --tags --progress git@github.com:myrepo/ios.git +refs/heads/master:refs/remotes/origin/master --prune" returned status code 128:
21:29:34 stdout: 
21:29:34 stderr: jenkins@github.com: Permission denied (publickey).
21:29:34 fatal: Could not read from remote repository.
21:29:34 
21:29:34 Please make sure you have the correct access rights
21:29:34 and the repository exists.
21:29:34 
21:29:34    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1719)
21:29:34    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1463)
21:29:34    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:63)
21:29:34    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:314)
21:29:34    at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:152)
21:29:34    at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:145)
21:29:34    at hudson.remoting.UserRequest.perform(UserRequest.java:120)
21:29:34    at hudson.remoting.UserRequest.perform(UserRequest.java:48)
21:29:34    at hudson.remoting.Request$2.run(Request.java:326)
21:29:34    at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
21:29:34    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
21:29:34    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
21:29:34    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
21:29:34    at hudson.remoting.Engine$1$1.run(Engine.java:62)
21:29:34    at java.lang.Thread.run(Thread.java:748)
21:29:34    at ......remote call to App_test_2(Native Method)
21:29:34    at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1416)
21:29:34    at hudson.remoting.UserResponse.retrieve(UserRequest.java:220)
21:29:34    at hudson.remoting.Channel.call(Channel.java:781)
21:29:34    at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.execute(RemoteGitImpl.java:145)
21:29:34    at sun.reflect.GeneratedMethodAccessor414.invoke(Unknown Source)
21:29:34    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
21:29:34    at java.lang.reflect.Method.invoke(Method.java:497)
21:29:34    at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.invoke(RemoteGitImpl.java:131)
21:29:34    at com.sun.proxy.$Proxy84.execute(Unknown Source)
21:29:34    at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:764)
21:29:34    ... 11 more
2

我对 jenkins@github.com 用户持怀疑态度,因为从 github 进行 ssh 克隆通常使用 git@github.com

是否有人对如何修复此 SSH 错误有建议?我可以提供更多详细信息吗?

【问题讨论】:

    标签: macos jenkins hudson macos-mojave


    【解决方案1】:

    这个 Jenkins JIRA 错误:Wrong username used for git clone with OpenSSH 7.7 最有帮助地回答了我上面的问题。确切的问题并不相同,但列出的修复程序at the bottom 涉及在用户名设置为“git”的 Jenkins Master 上创建一组新凭据解决了我的问题。重申一下,修复是使用 Jenkins GUI 设置一组新的 ssh 凭据,并使用 Github's documentation 所述生成的新私钥并将该私钥添加到 Jenkins,确保更改默认用户名“jenkins " 到 "git"。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-10-13
      • 1970-01-01
      • 2017-05-25
      • 1970-01-01
      • 2014-10-22
      • 2013-11-16
      相关资源
      最近更新 更多