如何将Jenkins链接到私有Github存储库?
我的目标是将一个私有Github存储库拉到Jenkins 以下是一些背景:如何将Jenkins链接到私有Github存储库?,github,jenkins,Github,Jenkins,我的目标是将一个私有Github存储库拉到Jenkins 以下是一些背景: 马科斯 Jenkins在本地托管,localhost:8080 在Jenkins中安装了Git插件和Github插件 如果我将存储库公开,詹金斯的一切都很好 在命令行中,我可以用我在Jenkins中使用的相同凭据进行“git克隆”那个私有回购 但当我把它变成私人的,并用它作为詹金斯的来源时,它就坏了 错误是: Building in workspace /Users/Shared/Jenkins/Home/jobs/Te
localhost:8080
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:
我在网上尝试了一些建议:
但仍然不起作用。我想问题可能是:当Jenkins试图克隆回购或获取回购信息时,它将使用一个名为Jenkins的用户名。当然,该用户无权访问您的私人回购协议。如果从命令行执行此操作,您将使用自己的用户名,因此可以成功克隆回购 您可以通过在项目配置中更改源代码管理的设置来解决此问题 我们正在做的是为github repo使用“用户名加密码”凭据
(使用凭据插件添加帐户和密码在某种程度上是安全的,因此您无需担心暴露帐户和密码)我用于创建SSH的命令是:SSH keygen。我应该添加一些标签吗?我不确定。thanksI会将这个问题标记为重复,但我看不到这个选项。也许我的名声太低了。无论如何,我想你应该看看这篇文章。这个问题不是你在@user985366上发布的链接的副本。这里的问题是使用git-repo的私有repo的获取标记超时。你评论的问题链接与身份验证和设置有关。我面临这个问题,我已经用凭证插件配置了我的repo,仍然是相同的错误