1
votes

A batch file (c:\myBatchFile.bat) exists on a build agent. When the batch file is run, it successfully does the following:

cd c:\myrepo
git pull

However, When I tell a powershell task, within a VSTS build job, to run c:\myBatchFile.bat the following error occurs:

error: failed to execute prompt script (exit code 255)
fatal: could not read Username for 'https://whatever.visualstudio.com': No error

Note: c:\myrepo is an aside to the build source repo used by the VSTS job.

Equally, just telling the VSTS build job powershell task directly to issue the two commands (cd c:\myrepo & git pull), this results in the same error at the git pull stage.

Git on the build agent machine itself, is authenticated with VSTS. It seems that when the third party (the build job) attempts to run the command on the agent (by way of creating a powershell script on the agent, and executing the powershell script), the command then fails.

Any ideas around this?

Thanks

1

1 Answers

0
votes

The main idea is to check which user is running the powershell task (when it is trigger by the VSTS build job)

Because if it works in one context and not the other, changes are, for an HTTPS URL, that a git credential helper helped in one case.

Execute git config credential.helper in both instance.