I'm using Visual Studio Online with Git and have set up continuous build with a build agent running on a VM that I control.
I added a PowerShell script step to build msi file on versioned commits, meaning they have a tag. The problem is that tags is not automatically fetched when the repo is synced in the first step (Visual studio).
I thought I could fix this by just adding "git fetch --tags" to the beginning of the PowerShell script, but this prints this error:
[error]bash: /dev/tty: No such device or address
[error]error: failed to execute prompt script (exit code 1)
[error]fatal: could not read Username for 'https://myaccount.visualstudio.com': Invalid argument
When I set up the build agent it created an access token, but that is obviously not used and it prompts for username/password.
Anybody know how to solve this?
There is Git Build Tools, an extension for VSTS wich provides two new build tasks to rewrite the remote URL with the OAuth token provided by VSTS (you'll need to enable this on the build definition). With this approach you don't need a specific service user account and credential manager on the build agent.
Allow Scripts to Access OAuth Token
option in the build definition options set.You can find full source code here and further documentation in the wiki.