I am trying to connect to github using Jenkins Credential plugin
withCredentials([usernamePassword(credentialsId: gitCredential, passwordVariable: 'GIT_PASSWORD', usernameVariable: 'GIT_USERNAME')]) {
sh("git push https://${GIT_USERNAME}:${GIT_PASSWORD}@stash.abc.com:656/rad/abl/optical.git --tags")
}
I am trying to push into Git, but it is failing with the below error, since the password contains @. Since there is no way we could urlEncode on the password obtained from the Jenkins credential plugin. I am looking for a way to resolve the username and password correctly.
[Tagging] Running shell script
+ git push 'https://****:****@stash.abc.com:656/rad/abl/optical.git' --tags
fatal: unable to access 'https://****:ZxmP*K@v6iO/?w4ms@stash.abc.com:656/rad/abl/optical.git': Couldn't resolve host 'v6iO'
[Pipeline] }
[Pipeline] // withCredentials
Any input would be helpful.
Thanks !