我正在使用jenkins作为dockerimage 我用下面的git详细信息创建了一个简单的工作: 我确实从jenkins ui添加凭据:-
url: https://myTeam:appPassword@bitbucket.org/MinoxTeam/bizcuit.git
credentials : myTeam /appPassword
这适用于简单的工作
我想为jenkins创建管道并使用jenkinsfile 我对管道使用相同的git凭据 但是错误:无法获取原始主机。 错误是:
stderr: remote: Invalid username or password
fatal: Authentication failed for 'https://team:appPassword.git/'
hudson.plugins.git.GitException: Failed to fetch from https://myTeam.myRepository.git
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:888)
我的jenkinsfile
pipeline {
agent any
options {
skipDefaultCheckout()
}
stages {
stage(checkout) {
steps {
ws('/var/jenkins_home/workspace/pipelineDemo@script') {
git branch: 'feature/jenkinsTest',
credentialsId: 'appPassword',
url: 'https://myTeam:appPassword@bitbucket.org/myTeam/myRepository.git'
sh "ls -lat"
}
}
}
答案 0 :(得分:1)
credentialsId: 'appPassword'
必须是凭据的ID,而不是密码本身。