1

I have written a PowerShell script to force push just a text file with version number(nuget package version to link with commit number) into server git-tfs repo and this script works perfectly fine when run manually(powershell ISE) on build server/machine (have rights to force push). But when I try to run this on same machine through a VSTS agent(CI build), the build gets hung exactly when trying to push to the server and also when I log into that build machine I don't see any prompts for credentials. Please let me know if I am missing any thing here, because the same process works successfully with TFVC repository.

The script is as follows:

$BuildVersion = "0.1.0"

$source_dir = "$env:SYSTEM_DEFAULTWORKINGDIRECTORY\***\**.txt"

git checkout develop

New-Item $source_dir -type file -Force -value $BuildVersion

git add $source_dir

git commit --amend --author="buildservice@***.com>" -m "NuGet package version check-in as part of build: $BuildVersion ***NO_CI***"

git push origin HEAD:develop -f
christoph
  • 628
  • 7
  • 18
S Mir
  • 33
  • 4
  • Could it be waiting for input? For example, your agent is running as service and not under your user, so git couldn't find the ssh keys / credential you previously stored for your interactive execution. Hence it is trying to wait for your credential input – Adrian Shum Sep 13 '18 at 04:24
  • I agree with you that it might be waiting for me to input credentials, but when I log into the build machine I don't see any prompts for credentials. Please let me know how to interactively point the script to access the build service credentials, without manually providing credentials(cannot provide credentials on build machine or in any script). – S Mir Sep 13 '18 at 20:35

0 Answers0