I had a similar problem and found this post helpful. There are three things that determine the user bindings between your commits to git and build information in TeamCity:
- Setting the correct git identity in your local clone (i.e.
git config user.name
, and also user.email
). This is how git stamps your commits.
- Establishing the mapping between your git identity and your TeamCity identity. This is done by setting the UserName Style in the advanced settings of your VCS roots.
- Setting the default username in the Version Control Username Settings in your TeamCity user profile. This is the value that will be used as the lookup key by the mapping you specified in #2.
So, for example, assume a user has a local clone git identity of user.name JCoder
and user.email joe.coder@foo.com
(#1 above), and UserName Style of UserId
(#2) above, and a TeamCity account with the Name Joseph Coder
and Version Control Username Setting of joe.coder
(#3) above.
TeamCity will correctly attribute this user's changes (in build history, for example) to the TeamCity user Joseph Coder
. This is because the UserName Style of UserId
maps between git and TeamCity users by using the email prefix of user.email, joe.coder
in this case. Note that there are several Username Styles (mapping styles). I stick with UserId
because it uses the email address which is typically the most stable identifier.