Kyle V.
Kyle V.

Reputation: 4792

How to use TFS credentials as commit author?

It appears that on our Team Foundation Server 2015 when I check into our Team Project's GIT repository it will attribute the commit author as whatever is in the user's .gitconfig file under [user]. I feel like this is wrong since everyone signs into our TFS server with their TFS credentials (AD credentials) so why wouldn't I want to be able to trace a commit back to a particular TFS team member?

Is this something that could be configured on the TFS or GIT repo server side?

Upvotes: 1

Views: 263

Answers (2)

Philippe
Philippe

Reputation: 31137

No, that's not possible and this made by design due to the fact that git is a decentralised VCS.

To be able to exchange commits, git use the sha1 which is the hash that permit to be sure that the commit (and all its history) is unique.

And this sha1 is computed from the files contents and the commit metadata. Some of them are the name and email of the author and commiter.

If you want to change this metadata when pushing, you will have to modify the commit and end with a different sha1.

If the sha1 has changed, all the way git work could not work anymore...

Credentials are just here to verify if you have the right to push some commits and not verify nor alter what you push.

PS: you could see the metadata of a commit using the command git cat-file -p SHA1_OF_A_COMMIT

Upvotes: 1

Daniel Mann
Daniel Mann

Reputation: 59018

Git commits are created offline and then pushed to a remote. In this case, the remote is TFS, but the remote could just as easily be GitHub, a repo hosted in a file share, or even another folder on your local PC.

So basically, no. A commit is created locally based off of the user's .gitconfig. You can't change that.

Upvotes: 2

Related Questions