Is there as way to have a stage like so in a Jenkinsfile:
stage('Create Branch & Push Branch') {
steps {
script {
sh "git checkout -b release/${NEW_TAG}"
sh "git push --set-upstream
}
}
}
Currently this leads to:
- 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
The repository was originally cloned earlier in the pipeline using:
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']]]
That part works ok (the clone), presumably because I can supply this step with the jenkins credential id for github.
Is there a way for me to do the same to push back to a repo that was cloned earlier in the build?