Managing My Many Hats on GitHub

Like many developers, I contribute to open source projects at home – usually to scratch an itch, learn something new or just to contribute to something I love using myself. However, I work for the open source .NET Foundation which means I have a dream job of getting paid to work on open source. Finally, I’m also still employed by Microsoft and get to make contributions to open source projects on their behalf which is also a pretty good gig.

When I commit to Git, I make sure my email address is set correctly based on what hat I’m wearing. On my work machines I have my work email configured by default and on my home machine I have my personal email configured by default.  To configure your default email address for Git remember from the excellent Git Book that you do:

git config --global "John Doe"
git config --global

As I use my work machine for work and my personal machine for personal stuff, this usually works well. However sometimes I want to make a quick update to something at work from my personal machine. But that’s fine because Git also provides a way to specify any git config setting per repository.  Once you have cloned down the Git repository, you cd into the repository and then simply type the same command without the -–global parameter, i.e:

git config

Which will override the default email address set on your machine but just for that one repository. The repository wide (local) settings are stored in a file called config with-in the .git folder in your repository, the global settings are stored in a file called .gitconfig in your users home directory.

Next, I like to make sure all my contributions come back to my GitHub identity. Luckily, GitHub have an easy mechanism to associate multiple email addresses with one GitHub account.  Simply go to your profile, and make sure all the emails you use to commit to Git are configured.  I have a few different ones listed in mine


And that’s it – when commits are pushed to GitHub using either my home, work or .NET Foundation email addresses they all come back to my GitHub profile so people can see what I as an individual am involved with.


Creative Commons License
This blog is licensed under a Creative Commons License.