git - 来自 SCM 的 jenkins 管道脚本 - > 错误:获取远程 repo 'origin' 时出错
问题描述
我正在使用 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)
我的詹金斯档案
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"
}
}
}
解决方案
credentialsId: 'appPassword'
必须是凭据的 ID,而不是密码本身。
推荐阅读
- java - 我的登录无效。我在代码中使用了用户名和密码
- laravel - 在 laravel 5.5 中手动身份验证总是返回 false?
- php - 什么会导致表单的“插入”代码仅在 80% 的时间内保存到数据库中?
- python - 用python3中的特定元素替换元素组
- email - 将电子邮件发送到保存在 Talend 的 csv 文件中的地址
- python - 如何正确编写从网页中提取所有链接的程序?
- reactjs - react-select - onInputChange 事件不记录选中选项的值,那么如何获取呢?
- java - 无法对数组类型 String[] 调用 split(String)
- java - 使用 java 的扫描仪读取输入
- python - 努力使用递归代码来二分搜索字符串