Reputation: 41
I'm using Jenkins 2.74.
I'm trying to push commits to the Git repo after doing changes.
This is my pipeline code:
stage('push to git') {
steps{
bat returnStdout: true, script: '"C:\\Program Files\\Git\\bin\\git.exe" add -A'
bat returnStdout: true, script: '"C:\\Program Files\\Git\\bin\\git.exe" commit -m "upadte yaml"'
bat returnStdout: true, script: '"C:\\Program Files\\Git\\bin\\git.exe" push -u origin master'
}
}
But, for some reason, the job cannot be completed and it's stuck like this:
I tried it on my machine, using windows cmd, and it works.
But not on Jenkins.
What am I doing wrong?
Upvotes: 3
Views: 3080
Reputation: 1027
I had the same problem when process git clone command by windows shell/bat in jenkins. This is my solution:
Register key in know_host file Jenkins will not auto import new key of known host to your know_host file. You can do it manually by following these steps:
[gerrit.cartography.com]:29168,[10.25.174.78]:29168 ssh-rsa AAAAB3NzaC1yc2EAASSSSAQABAAAAgQDPHbDKCHL3oPbzDn3qaVZR8S1EZx/rb500Th/fjQYg5jrJ7PBMVVUyNTpJ2moje5hLYjNsVtXtcoNEZjImGul2dl3f+eHrCB27X5198jr8Wj66I/xsQCLEngd7l3velsdfgd3432fsdDiFaE9INjDjgngfNzlFA+CYpFsnaorZ6XSPQ==
paste to end of 'system' know_hosts
file in
I think you will resolve your problem now ! Enjoy it!
Upvotes: 1
Reputation: 41
I've solved the same problem.
Jenkins job stuck forever after executing git push command. But, same command works fine in Windows cmd.
I tried to execute git clone command as follows,
http://{GIT_ID}:{GIT_PASSWORD}@{REPOSITORY}.git
and added modifications, committed and pushed.
Then it was finished successfully.
Upvotes: 1
Reputation: 41
I got the answer, you need to check some details:
That's it, i think.
Upvotes: 0
Reputation: 7375
I experienced a similar problem (pushing a tag) with git for windows version 2.13.0. Updating to 2.14.2 fixed it for me.
Upvotes: 0