凭证管理如何与Jenkins,jenkins从节点和git一起使用?

问题描述 投票:1回答:1

我对Jenkins来说还比较陌生,一直在研究一个流水线,该流水线在每次推送到我们的Bitbucket服务器时都会触发构建。我们有一个主人和一个奴隶。最近,很明显,在从属服务器(Windows 2012服务器)上,我们构建的某些依赖关系并不容易实现。我知道正确的解决方案是对docker进行操作,但是我对此还不够熟悉,我认为快速的解决方法是从我的工作站运行jenkins从属节点,我知道我拥有所有依赖项完成,然后稍后再与docker做适当的工作。

我有一个新的问题,当作业分发到我的工作站时,出现以下错误日志:

using GIT_ASKPASS to set credentials credential_name (credential_label)
Setting http proxy: proxy.proxy.blah
 > C:\Program Files\Git\cmd\git.exe fetch --tags --force --progress -- <http address> +refs/heads/*:refs/remotes/repo_name/* # timeout=10
ERROR: Error fetching remote repo 'repo_name'
hudson.plugins.git.GitException: Failed to fetch from <http_address>
    at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:909)
    at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1131)
    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1167)
    at com.atlassian.bitbucket.jenkins.internal.scm.BitbucketSCM.checkout(BitbucketSCM.java:203)
    at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:124)
    at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:93)
    at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:80)
    at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    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 java.lang.Thread.run(Unknown Source)
Caused by: hudson.plugins.git.GitException: Command "C:\Program Files\Git\cmd\git.exe fetch --tags --force --progress -- <http_address> +refs/heads/*:refs/remotes/<repo_name>/*" returned status code 128:
stdout: 
stderr: fatal: Authentication failed for <http_address>

另一个从站从未发生过此问题,我不记得必须为该从站进行任何凭据配置。我的怀疑如下:我已经在工作站上完成了一些凭据配置工作(通过SSH访问bbucket服务器,用户名等)。我的本地git凭据配置是否可能与Jenkins从节点的请求冲突?也许有人谁更了解jenkins和git如何管理凭据,可以帮助我更好地了解情况,以便我寻求解决方案?目前,我什至不知道如何调试我的问题。

感谢您的帮助,我会尽力提示您对任何问题的答复,以供澄清。

git jenkins bitbucket
1个回答
0
投票

我的本地git凭据配置是否有可能与Jenkins从节点的请求冲突

首先检查您的git config credential.helper输出。

如果返回“ manager”,则Windows凭据存储seen here可能使用错误的用户名/密码来访问该存储库。

假设您的Jenkins代理正在使用您的帐户(而不是Windows系统帐户)在您的工作站上运行

您可以reject those credentials并进行一次手动git fetch,以提示凭据对话框并输入正确的用户名/密码。

© www.soinside.com 2019 - 2024. All rights reserved.