David Walschots David Walschots - 1 month ago 6
Git Question

Does TFS with Git VC store the authenticated username next to the commit username?

I've recently introduced Git within my company. Git allows users to set their user.name and user.email to whatever value they wish. For auditing reasons, I need to know with certainty which TFS/Active Directory user pushed commits to the TFS on-premise server repository. Does TFS store this information somewhere? Or should I introduce signed commits instead?

Answer

What you are looking for is "pushedBy" field. When the user set the user.name and user.email, the "author" and "committer" will use the user.name, but the "pushedBy" still uses the TFS/Active Directory name.

Two ways to check the pushedBy user:

  1. Go to Web portal, and select the commit history, you'll see who push this commit.

enter image description here

  1. Use TFS Rest Api to get a push, then you'll get the pushedBy in Response:

API:

GET http://tfsserver:8080/tfs/CollectionName/_apis/git/repositories/xxxxxxx/pushes/xxx?api-version=1.0
Comments