是否有一种方法可以在Jenkinsfile中像这样使用stage:
stage('Create Branch & Push Branch') {
steps {
script {
sh "git checkout -b release/${NEW_TAG}"
sh "git push --set-upstream
}
}
}
目前这导致了:
- git push --set-upstream origin release/v1.0.3 fatal: could not read Username for 'https://github.com': No such device or address script returned exit code 128
仓库最初是在管道早期使用以下命令进行克隆的:
checkout poll: false, scm: [$class: 'GitSCM', branches: [[name: 'develop']], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'CleanBeforeCheckout'], [$class: 'CleanCheckout'], [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false]], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'ci-github', url: 'https://github.com/my-org/my-repo.git']]]
这部分工作(克隆)是正常的,很可能是因为我可以为GitHub提供Jenkins凭据ID。
那么,有没有办法让我向在构建过程中先克隆的存储库推送相同的内容?
git push https://****:****@repository.git HEAD:<name-of-remote-branch>
- Rob Juurlink