I’m new to Jenkins and have a Windows install. I’m stuck trying to push tags to github.
I have the gitPush plugin installed, but can’t figure out the pipeline syntax for it.
Is this the right thing to be using or is there a better approach?
Thanks!
There is a better approach for Pipeline. The git plugin provides a withCredentials
wrapper that will allow you to run command line git to perform the push. Read more about it in the git plugin documentation.
The example in the documentation shows a Windows example of git push
:
withCredentials([gitUsernamePassword(credentialsId: 'my-credentials-id',
gitToolName: 'git-tool')]) {
powershell 'git push'
}
That example assumes an https URL for the remote git repository. If you’re using an ssh URL for the remote git repository, then you can use the ssh-agent
plugin to provide a plugin wrapper that will allow the same type of syntax.
1 Like
Thanks for your help Mark
I have an ssh URL so have set up the script to use ssh-agent.
After changing the path to use the git ssh-agent and a reboot, everything is working.