我的目标是将一个私人Github存储库提供给Jenkins。如何将Jenkins链接到私人Github存储库?
下面是一些背景:
- 的MacOS
- 詹金斯本地托管,
localhost:8080
- 安装Git插件可和Github上的插件在詹金斯。
- 如果我将存储库设置为Public,那么Jenkins中的一切都很好。
- 从命令行,我可以做“git克隆”那个私人回购与我在詹金斯使用相同的凭据。
但是,当我把它变成Private并将它用作Jenkins的源代码时,它已经损坏。
的错误是:
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-凯基到/Users/shared/jenkins/.ssh/id_rsa
- SSH- keygen to /Users/jason/.ssh/id_rsa
- 将两个相应的“id_rsa.pub”添加到私人存储库“设置”=>“部署密钥”。
但仍然无法正常工作。
我用来创建SSH命令只是:SSH-凯基。我应该添加一些标签吗?不确定。谢谢 –
我会将此问题标记为重复,但我没有看到该选项。也许我的声誉太低了。无论如何,我认为你应该看看这个帖子。 https://stackoverflow.com/questions/5212304/authenticate-jenkins-ci-for-github-private-repository – user985366
此问题不是您发布的@ user985366链接的副本。这里的问题是使用git repo的私人回购的提取标签超时。您所评论的问题链接与身份验证和设置相关 –