【发布时间】:2017-08-29 11:10:42
【问题描述】:
我的目标是将私有 Github 存储库拉到 Jenkins。
这里有一些背景:
- MacOS
- Jenkins 本地托管,
localhost:8080 - 在 Jenkins 中安装了 Git 插件和 Github 插件。
- 如果我将存储库设为公开,Jenkins 中的一切都很好。
- 从命令行,我可以使用我在 Jenkins 中使用的相同凭据执行“git clone”该私有存储库。
但是当我将其设置为 Private 并将其用作 Jenkins 的 Source 时,它就坏了。
错误是:
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”添加到私有存储库“设置”=>“部署密钥”。
但还是不行。
【问题讨论】:
-
我用来创建 SSH 的命令只是: ssh-keygen 。我应该添加一些标签吗?不确定。谢谢
-
我会将此问题标记为重复,但我没有看到该选项。也许我的名声太低了。无论如何,我认为你应该看看这篇文章。 stackoverflow.com/questions/5212304/…
-
此问题与您发布的@user985366 链接不重复。这里的问题是使用 git repo 的私有 repo 的获取标签超时。您评论的问题链接与身份验证和设置有关