In my case, I was forced to work with HTTPS. I solved this:
- Create username / password credentials bitbucketUsernamePassword .
- Use this identity for verification.
- Install credential.helper before doing the validation.
- Running a git checkout branch to get the remote tracker of the local branch.
Then I can promote things with git push .
Like this:
sh 'git config --global credential.helper cache' sh 'git config --global push.default simple' checkout([ $class: 'GitSCM', branches: [[name: branch]], extensions: [ [$class: 'CloneOption', noTags: true, reference: '', shallow: true] ], submoduleCfg: [], userRemoteConfigs: [ [ credentialsId: 'bitbucketUsernamePassword', url: cloneUrl] ] ]) sh "git checkout ${branch}" //To get a local branch tracking remote
Then I can do things like:
sh 'git push'
Tomas bjerre
source share