升级到Mojave后,使用hudson对jenkins进行Git身份验证失败

问题描述 投票:0回答:1

我们的CI(Jenkins)之前使用标准的主从配置工作在High Sierra,其中主服务器在构建时为从服务器提供ssh凭证。升级到mojave后,我们的所有构建都失败了以下消息:

21:29:33 Fetching changes from the remote Git repository
21:29:33  > git config remote.origin.url [email protected]:myrepo/ios.git # timeout=10
21:29:33 Pruning obsolete local branches
21:29:34 Fetching upstream changes from [email protected]/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 [email protected]: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 [email protected]: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 [email protected]:myrepo/ios.git +refs/heads/master:refs/remotes/origin/master --prune" returned status code 128:
21:29:34 stdout: 
21:29:34 stderr: [email protected]: 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

我对[email protected]用户持怀疑态度,因为来自github的ssh克隆通常以[email protected]完成。

有没有人有关于如何修复此SSH错误的建议?我可以提供更多细节吗?

macos jenkins hudson macos-mojave
1个回答
0
投票

我的问题最有帮助的是这个Jenkins JIRA Bug:Wrong username used for git clone with OpenSSH 7.7。确切的问题不一样,但修复列出的at the bottom涉及在Jenkins Master上创建一组新的凭据,用户名设置为“git”解决了我的问题。重申一下,修复是使用Jenkins GUI设置一组新的ssh凭证,其中包含Github's documentation描述的新私钥,并将该私钥添加到Jenkins,确保将默认用户名“jenkins”更改为“混帐”。

© www.soinside.com 2019 - 2024. All rights reserved.