GitHub vie Blue Ocean 代理:用户名或密码无效
GitHub vie Blue Ocean Agent: Invalid username or password
我用谷歌搜索的行是:
remote: Invalid username or password.
稍微回溯一下:
我使用 Jenkins 上的 Blue Ocean 创建了一个管道,用于 运行 存储在我们 GitHub Enterprise 上的东西。我们的内部企业支持 http 连接(不是 https 或 ssh)。 API 令牌帮助 jenkins master 与 github 成功交互,包括获取管道并将其推送到 repo。
当涉及到执行时,作业被转发给代理。该代理尝试连接到给定地址,就像主服务器一样,但它没有成功获取内容,而是收到消息:
stderr: remote: Invalid username or password.
我想弄清楚的是令牌是如何从主服务器到代理服务器的,以及为什么这在我的情况下不起作用。
在使用谷歌搜索时,我发现了几次这种症状 - none 似乎适用于我的情况。
我认为正在发生的事情是节点使用两个因素而不是令牌,然后 GIT_ASKPASS 似乎再次生成令牌 - 在这种情况下我不知道为什么令牌适用于master 但不是 agent.
这是蓝海日志 - 为匿名而略有改动。
Cloning the remote Git repository
Cloning with configured refspecs honoured and without tags
Cloning repository http://github.mycompany.de/myorg/myrepo.git
> git init C:\jenkins\nodes\guinode\workspace\myrepo_master-CFRRXMXQEUULVB4YKQOFGB65CQNC4U5VJKTARN2A6TSBK5PBATBA # timeout=10
Fetching upstream changes from http://github.mycompany.de/myorg/myrepo.git
> git --version # timeout=10
using GIT_ASKPASS to set credentials GitHub Enterprise Access Token
Setting http proxy: con-ffm-asg-01.mycompany.de:8080
> git fetch --no-tags --progress http://github.mycompany.de/myorg/myrepo.git +refs/heads/master:refs/remotes/origin/master
ERROR: Error cloning remote repo 'origin'
hudson.plugins.git.GitException: Command "git fetch --no-tags --progress http://github.mycompany.de/myorg/myrepo.git +refs/heads/master:refs/remotes/origin/master" returned status code 128:
stdout:
stderr: remote: Invalid username or password.
fatal: Authentication failed for 'http://github.mycompany.de/myorg/myrepo.git/'
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2002)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1721)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access0(CliGitAPIImpl.java:72)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.execute(CliGitAPIImpl.java:405)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.execute(CliGitAPIImpl.java:614)
at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.call(RemoteGitImpl.java:153)
at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.call(RemoteGitImpl.java:146)
at hudson.remoting.UserRequest.perform(UserRequest.java:207)
at hudson.remoting.UserRequest.perform(UserRequest.java:53)
at hudson.remoting.Request.run(Request.java:358)
at hudson.remoting.InterceptingExecutorService.call(InterceptingExecutorService.java:72)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at hudson.remoting.Engine.run(Engine.java:98)
at java.lang.Thread.run(Unknown Source)
Suppressed: hudson.remoting.Channel$CallSiteStackTrace: Remote call to JNLP4-connect connection from myagent.auto.mycompanywan.com/12.13.14.15:58671
at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1693)
at hudson.remoting.UserResponse.retrieve(UserRequest.java:310)
at hudson.remoting.Channel.call(Channel.java:908)
at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.execute(RemoteGitImpl.java:146)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.invoke(RemoteGitImpl.java:132)
at com.sun.proxy.$Proxy98.execute(Unknown Source)
at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1146)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1186)
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.call(AbstractSynchronousNonBlockingStepExecution.java:47)
at hudson.security.ACL.impersonate(ACL.java:260)
at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution.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)
Error cloning remote repo 'origin'
在代理计算机上,我可以看到正在创建的文件夹,因此执行肯定发生在代理端。
我的核心问题是我的令牌发生了什么以及需要发生什么以便代理机器可以连接到我们的企业 github。
相关性不是因果关系,但我在 Jenkins -> Configure Global Security
中激活了 Enable Agent → Master Access Control
,现在 SCM 步骤成功了。
编辑:我尝试使用凭据,删除了一些并重新创建了一个令牌。之后错误再次出现。取消选中该选项,点击应用,然后选中该选项并点击应用为我修复了这个问题。
我用谷歌搜索的行是:
remote: Invalid username or password.
稍微回溯一下:
我使用 Jenkins 上的 Blue Ocean 创建了一个管道,用于 运行 存储在我们 GitHub Enterprise 上的东西。我们的内部企业支持 http 连接(不是 https 或 ssh)。 API 令牌帮助 jenkins master 与 github 成功交互,包括获取管道并将其推送到 repo。
当涉及到执行时,作业被转发给代理。该代理尝试连接到给定地址,就像主服务器一样,但它没有成功获取内容,而是收到消息:
stderr: remote: Invalid username or password.
我想弄清楚的是令牌是如何从主服务器到代理服务器的,以及为什么这在我的情况下不起作用。
在使用谷歌搜索时,我发现了几次这种症状 - none 似乎适用于我的情况。
我认为正在发生的事情是节点使用两个因素而不是令牌,然后 GIT_ASKPASS 似乎再次生成令牌 - 在这种情况下我不知道为什么令牌适用于master 但不是 agent.
这是蓝海日志 - 为匿名而略有改动。
Cloning the remote Git repository
Cloning with configured refspecs honoured and without tags
Cloning repository http://github.mycompany.de/myorg/myrepo.git
> git init C:\jenkins\nodes\guinode\workspace\myrepo_master-CFRRXMXQEUULVB4YKQOFGB65CQNC4U5VJKTARN2A6TSBK5PBATBA # timeout=10
Fetching upstream changes from http://github.mycompany.de/myorg/myrepo.git
> git --version # timeout=10
using GIT_ASKPASS to set credentials GitHub Enterprise Access Token
Setting http proxy: con-ffm-asg-01.mycompany.de:8080
> git fetch --no-tags --progress http://github.mycompany.de/myorg/myrepo.git +refs/heads/master:refs/remotes/origin/master
ERROR: Error cloning remote repo 'origin'
hudson.plugins.git.GitException: Command "git fetch --no-tags --progress http://github.mycompany.de/myorg/myrepo.git +refs/heads/master:refs/remotes/origin/master" returned status code 128:
stdout:
stderr: remote: Invalid username or password.
fatal: Authentication failed for 'http://github.mycompany.de/myorg/myrepo.git/'
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2002)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1721)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access0(CliGitAPIImpl.java:72)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.execute(CliGitAPIImpl.java:405)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.execute(CliGitAPIImpl.java:614)
at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.call(RemoteGitImpl.java:153)
at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.call(RemoteGitImpl.java:146)
at hudson.remoting.UserRequest.perform(UserRequest.java:207)
at hudson.remoting.UserRequest.perform(UserRequest.java:53)
at hudson.remoting.Request.run(Request.java:358)
at hudson.remoting.InterceptingExecutorService.call(InterceptingExecutorService.java:72)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at hudson.remoting.Engine.run(Engine.java:98)
at java.lang.Thread.run(Unknown Source)
Suppressed: hudson.remoting.Channel$CallSiteStackTrace: Remote call to JNLP4-connect connection from myagent.auto.mycompanywan.com/12.13.14.15:58671
at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1693)
at hudson.remoting.UserResponse.retrieve(UserRequest.java:310)
at hudson.remoting.Channel.call(Channel.java:908)
at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.execute(RemoteGitImpl.java:146)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.invoke(RemoteGitImpl.java:132)
at com.sun.proxy.$Proxy98.execute(Unknown Source)
at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1146)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1186)
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.call(AbstractSynchronousNonBlockingStepExecution.java:47)
at hudson.security.ACL.impersonate(ACL.java:260)
at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution.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)
Error cloning remote repo 'origin'
在代理计算机上,我可以看到正在创建的文件夹,因此执行肯定发生在代理端。
我的核心问题是我的令牌发生了什么以及需要发生什么以便代理机器可以连接到我们的企业 github。
相关性不是因果关系,但我在 Jenkins -> Configure Global Security
中激活了 Enable Agent → Master Access Control
,现在 SCM 步骤成功了。
编辑:我尝试使用凭据,删除了一些并重新创建了一个令牌。之后错误再次出现。取消选中该选项,点击应用,然后选中该选项并点击应用为我修复了这个问题。