0

我用谷歌搜索的行是:

remote: Invalid username or password.

回溯一点:

我在 Jenkins 上使用 Blue Ocean 创建了一个管道来运行存储在我们 GitHub Enterprise 上的内容。我们的内部企业使用 http 连接(不是 https 或 ssh)。API 令牌帮助 jenkins master 成功地与 github 交互,包括获取和推送管道到 repo。

在执行时,作业被转发给代理。该代理尝试像主服务器一样连接到给定地址,但没有成功获取内容,而是收到消息:

stderr: remote: Invalid username or password.

我想弄清楚的是令牌如何从主服务器到代理,以及为什么这在我的情况下不起作用。

在谷歌搜索时,我发现了几次症状 - 似乎没有一个适用于我的情况。

我认为正在发生的事情是节点使用两个因素而不是令牌,然后 GIT_ASKPASS 似乎又生成了令牌 - 在这种情况下,我不知道为什么令牌适用于主服务器但不适用于代理。

这是蓝海日志 - 为匿名而略有改动。

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.access$300(CliGitAPIImpl.java:72)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:405)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:614)
    at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:153)
    at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:146)
    at hudson.remoting.UserRequest.perform(UserRequest.java:207)
    at hudson.remoting.UserRequest.perform(UserRequest.java:53)
    at hudson.remoting.Request$2.run(Request.java:358)
    at hudson.remoting.InterceptingExecutorService$1.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$1$1.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$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)
Error cloning remote repo 'origin'

在代理机器上,我可以看到正在创建的文件夹,因此执行肯定发生在代理端。

我的核心问题是我的令牌发生了什么以及需要发生什么,以便代理机器可以连接到我们的企业 github。

4

1 回答 1

0

相关性不是因果关系,但我激活Enable Agent → Master Access ControlJenkins -> Configure Global Security,SCM 步骤现在成功了。

编辑:我玩弄了凭据,删除了一些并重新创建了一个令牌。之后错误再次出现。取消选中该选项,点击应用,然后检查该选项并点击应用为我修复了这个问题。

于 2018-07-18T14:09:16.763 回答