Skip to content
Ken Dale
Go back

Using Different Email Addresses For Git Commits For Azure DevOps And GitHub

If you work with Azure DevOps and GitHub with different email addresses you may want to align your commit email addresses with the email addresses on your accounts.

We can do this automatically via ~/.gitconfig: (edit this file in your home directory or create it if it does not exist)

[user]
  name = Your Name
  email = YourGitHubEmail@example.com
[includeIf "hasconfig:remote.*.url:https://*dev.azure.com/**"]
  path = ~/.gitconfig-Azure-DevOps
[includeIf "hasconfig:remote.*.url:git@ssh.dev.azure.com:v3/**"]
  path = ~/.gitconfig-Azure-DevOps

Create the ~/.gitconfig-Azure-DevOps file that is linked to:

[user]
  email = YourAzureDevOpsEmail@example.com

This defaults to the GitHub email address and specifies a different email address for Azure DevOps. This should work for both HTTPS and SSH, provided the url patterns match one of the above.


Share this post:

Previous Post
Azure Key Vault: Certificate "Download in PFX/PEM format" Not Available
Next Post
Lessons Learned Implementing a Must Succeed Durable Functions Workflow