小编pau*_*rda的帖子

使用 jenkins Pipeline 作为代码从 bitbucket 私有存储库克隆

我使用 jenikins 管道作为代码来克隆位于私有 bitbucket 存储库(存储存储库)中的 git 项目。我使用此代码块在管道脚本中克隆项目。

node {  
//checkout from master  
stage 'checkout'  
   withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'MyID', usernameVariable: 'GIT_USERNAME', passwordVariable: 'GIT_PASSWORD']]) {  

      git url: 'https://paulrda@devMyCompany.org/stash/scm/test_automation.git' , branch: 'development'   
   }  
}  
Run Code Online (Sandbox Code Playgroud)

“MyID”是凭证 ID,我的用户名和密码是正确的。我将我的凭证保存在 jenkins 的全局凭证功能中。但是当我构建詹金斯任务时出现此错误。

错误:获取远程存储库“来源”时出错
hudson.plugins.git.GitException:无法从 https://paulrda@devMyCompany.org/stash/scm/test_automation.git 获取
    在 hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:803)
    在 hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1063)
    在 hudson.plugins.git.GitSCM.checkout(GitSCM.java:1094)
    在 org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:109)
    在 org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:83)
    在 org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:73)
    在 org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47)
    在 hudson.security.ACL.impersonate(ACL.java:221)
    在 org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:44)
    在 java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    在 java.util.concurrent.FutureTask.run(FutureTask.java:266)
    在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    在 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    在 java.lang.Thread.run(Thread.java:745)
引起:hudson.plugins.git.GitException:命令“git fetch --tags --progress https://paulrda@devMyCompany.org/stash/scm/test_automation.git +refs/heads/*:refs/remotes/origin /*”返回状态码128:
标准输出:
stderr:致命:“https://paulrda@devMyCompany.org/stash/scm/test_automation.git/”身份验证失败

    在org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1745)
    在org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1489)
    在org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:64)
    在 org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:315) …

jenkins jenkins-pipeline

2
推荐指数
1
解决办法
2万
查看次数

标签 统计

jenkins ×1

jenkins-pipeline ×1