我的目标是将一个私有Github仓库拉取到Jenkins上。
以下是一些背景信息:
错误信息如下:
以下是一些背景信息:
- 操作系统为MacOS
- Jenkins本地托管,网址为
localhost:8080
- 在Jenkins中安装了Git插件和Github插件。
- 如果我把仓库变成公共的,在Jenkins上就一切正常。
- 从命令行中,我可以使用相同的凭据“git clone”私人仓库。
错误信息如下:
Building in workspace /Users/Shared/Jenkins/Home/jobs/TestFramework/workspace
> /usr/bin/git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> /usr/bin/git config remote.origin.url https://github.com/XXXXXXX/testframework.git # timeout=10
Fetching upstream changes from https://github.com/XXXXXXX/testframework.git
> /usr/bin/git --version # timeout=10
using GIT_ASKPASS to set credentials
> /usr/bin/git fetch --tags --progress https://github.com/XXXXXXX/testframework.git +refs/heads/*:refs/remotes/origin/* # timeout=5
ERROR: Timeout after 5 minutes
ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from https://github.com/XXXXXXX/testframework.git
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:806)
at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1070)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1101)
at hudson.scm.SCM.checkout(SCM.java:496)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1278)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:604)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:529)
at hudson.model.Run.execute(Run.java:1728)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:405)
Caused by: hudson.plugins.git.GitException: Command "/usr/bin/git fetch --tags --progress https://github.com/XXXXXXX/testframework.git +refs/heads/*:refs/remotes/origin/*" returned status code 143:
我试了一些网上的建议:
- 将ssh-keygen生成到 /Users/shared/jenkins/.ssh/id_rsa
- 将ssh-keygen生成到 /Users/jason/.ssh/id_rsa
- 将对应的"id_rsa.pub"添加到私有仓库的“设置”=>“部署密钥”中。
但是还是不起作用。