I have spent a lot of time on this. This is not a duplicate of the cygwin post that is first on google search.
Normal GIT Repo works with credentials - I have many projects on Jenkins, using GIT, and they all work fine. These repo's take the repository URL and credentials and branch, and obviously uses GIT to operate.
Now, I need to execute a GIT command. It is a simple git tfs pull
and git push.
When I run these commands in console, it works fine. When I put it into a batch file and execute it myself, it runs fine. When I run the commands in "Execute Windows Batch command", then it hangs and does not execute.
I suspect it requires credentials. I do not know how to send the credentials for the batch command.
I have run the set
command, and can confirm that the user that is running during Jenkins execution, is not the same user when I run in command prompt.
How do I set the user to run this batch command as?
By default, Git for Windows will use as credential manager the Credential Manager of Windows, through the Git-Credential-Manager-for-Windows.
Check the output of
cd /path/to/repo
git config credential.helper
This is using credentials cached for a given user. One alternative would be to set those credentials in a simple text file (for testing): See "Git Tools - Credential Storage".
cd /path/to/repo
git config credential.helper store --file /path/to/repo/.git/.my-credentials
That way, any user in that repo would use the right credentials.