3

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?

2
  • Are you using https url? or ssh url? Commented May 25, 2017 at 5:16
  • I am using https url Commented May 25, 2017 at 5:41

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.