I am using

git branch: '<branch>' , credentialsId: 'ID_JENKINS' , url:<tfs_server>

to clone a repository, which works without problems.

But when I would like to do the same with

withCredentials([usernamePassword(credentialsId: 'ID_JENKINS', passwordVariable: 'GIT_PASSWORD', usernameVariable: 'GIT_USERNAME')]) {
  git clone http://${GIT_USERNAME}:${GIT_PASSWORD}@<tfs_server>

this does not work. As you can see, I am using the same credential id.

How does the git plugin handle the credentials in the background to get this working?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.