【发布时间】:2018-02-04 06:21:22
【问题描述】:
我做了设置
1) 配置全局安全中的 Github Oauth,我必须指定 clientID、secret 等..
2) 我还将jenkins机器的公钥添加到我的github帐户中
3) 我去 blueocean 并尝试创建管道,所以它要求我提供个人访问令牌,所以我这样做并成功创建了管道。
现在我运行了一个简单的 Job,但它失败了,因为它无法连接到 repo。不知道为什么?
> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url https://github.com/helloinc/test-repo.git # timeout=10
Fetching without tags
Fetching upstream changes from https://github.com/helloinc/test-repo.git
> git --version # timeout=10
using GIT_ASKPASS to set credentials GitHub Access Token
> git fetch --no-tags --progress https://github.com/helloinc/test-repo.git +refs/heads/jenkins-test:refs/remotes/origin/jenkins-test
ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from https://github.com/helloinc/test-repo.git
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:817)
at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1084)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1115)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:113)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:85)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:75)
at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47)
at hudson.security.ACL.impersonate(ACL.java:260)
at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:44)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: hudson.plugins.git.GitException: Command "git fetch --no-tags --progress https://github.com/helloinc/test-repo.git +refs/heads/jenkins-test:refs/remotes/origin/jenkins-test" returned status code 128:
stdout:
stderr: error: The requested URL returned error: 403 Forbidden while accessing https://github.com/helloinc/test-repo.git/info/refs
fatal: HTTP request failed
【问题讨论】:
-
This question 和this one 密切相关,请查看this answer。
-
尝试首先检查它是否通过
ssh -T git@github.com通过您的Github帐户进行了身份验证
标签: jenkins