【发布时间】:2019-09-22 01:20:28
【问题描述】:
我正在使用 jenkins 管道(声明式合成器),我想将提交推送到我的远程存储库。
有没有办法使用 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')
}
但它不起作用。 我收到以下错误:`
fatal: unable to access 'https://****:****@myrepositoryurl/mygitgroup/salesforce-backup/': Could not resolve host: ****:clear_password_here; Name or service not known
有人可以帮忙吗? 我虽然问题出在我的密码中的特殊字符,但我不确定。
【问题讨论】:
-
使用 Git Pipeline Plugin 可能会更容易。
-
jenkins 管道中没有用于 push 的 git 插件。有吗?
-
我们通过 url 编码密码解决了这个问题。问题是 GIT_PASSWORD 包含应该编码的特殊字符
标签: git jenkins jenkins-pipeline git-push