我的目標是將一個私人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的私人回購的提取標籤超時。您所評論的問題鏈接與身份驗證和設置相關 –