相关疑难解决方法(0)

使用来自声明性管道的 jenkins 凭据进行 Git 推送

我正在使用 jenkins 管道(声明性 synthax)并且我想将提交推送到我的远程存储库。

有什么方法可以使用 git 插件来完成此操作吗?这是我目前正在尝试的:

withCredentials([usernamePassword(credentialsId: "${GIT_CREDENTIAL_ID}", passwordVariable: 'GIT_PASSWORD', usernameVariable: 'GIT_USERNAME')]) {
                        sh "git add ${BRANCH_RENAME}.bundle"
                        sh "echo ${GIT_USERNAME}|||||||${GIT_PASSWORD}"
                        sh "git tag -a backup -m 'Backup branch ${BRANCH} from vega-salesforce to vega-salesforce-backup' "
                        sh('git push https://${GIT_USERNAME}:${GIT_PASSWORD}@${GIT_URL_WITHOUT_HTTPS} --tags')
                    }

Run Code Online (Sandbox Code Playgroud)

但它不起作用。我收到以下错误:`

fatal: unable to access 'https://****:****@myrepositoryurl/mygitgroup/salesforce-backup/': Could not resolve host: ****:clear_password_here; Name or service not known
Run Code Online (Sandbox Code Playgroud)

有人可以帮忙吗?我虽然问题来自我的密码中存在的特殊字符,但我不确定。

git git-push jenkins jenkins-pipeline

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

标签 统计

git ×1

git-push ×1

jenkins ×1

jenkins-pipeline ×1