我们的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错误?我还能提供更多细节吗?
答案 0 :(得分:0)
这个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,确保更改默认的用户名。从“詹金斯”到“ git”。