3

I need to automate the 'git-tfs pull' command in azure devops. I have no problem executing this command with my user/pass from cmd window, but when it runs in Azure DevOps Build Agent it doesn't finish, sure it is an authentication problem.

Git-commands have the possibility to pass additional http-headers with the request. This is used by Azure DevOps build agent to pass OAuth token in an AUTHORIZATION: bearer-header when fetching the files.

Is it possible that git-tfs pull can pass the extra headers with the request?

jessehouwing
  • 106,458
  • 22
  • 256
  • 341

1 Answers1

0

Is it possible that git-tfs pull can pass the extra headers with the request?

No...

But... I haven't tried this and I'm guessing it won't work, since setting an OAuth credential tends to require a different object type in the TFVC Client Object Model, but this may do the trick:

git config --local tfs-remote.default.username .
git config --local tfs-remote.default.password $(SYSTEM.ACCESSTOKEN)

This will set the OAuth token in pipelines as the password to use for authentication. Make sure the pipeline has access to this special variable.

If the OAuth Token for the pipeline won't do the trick, you could try using a Personal Access Token instead.

jessehouwing
  • 106,458
  • 22
  • 256
  • 341