Skip to content

Instantly share code, notes, and snippets.

@cornelius
Last active February 22, 2019 07:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cornelius/729f71c3c16ac452411ab46a9e00c3c5 to your computer and use it in GitHub Desktop.
Save cornelius/729f71c3c16ac452411ab46a9e00c3c5 to your computer and use it in GitHub Desktop.

Setting commit email for web based GitHub operations per organization

GitHub provides a number of wonderful features in the web UI which can be used to create commits. You can do things such as directly edit files, or squash and merge pull requests, or apply suggested changes from code reviews. This is great and makes things easy.

But if you want to use different emails in the git commits when you are contributing to different repositories, you can't. For example if you are part of an organization for work, and you also maintain an open source project as a side project, you can't do things like merging pull requests in the web UI with your personal address for the open source project and with your work address for the organization you work for.

The problem

There is just one problem with most of these features. Other when directly editing a file, you can't select the email address which is used as author in the commit. It always uses your primary email address or the "noreply" email, when you have activated the "keep my email address private" setting.

The exception is the pure web based commit. There you have a dropdown to choose an email address. But all the features which create implicit commits, such as squash and merge, rebase and merge, or code suggestions don't have this dropdown.

This is a problem when you are contributing to different projects where you use different organizations. Prime example would be if you are working for an organization where you use your work email, and also work on other open source projects in your free time where you use your private email.

There are some workarounds for some situations, such as changing the email address in the settings before doing a change, or using git on the command line instead of the UI, but that's not very convenient or practical. And there are some situations where it's pretty much impossible to work around the problem, e.g. when working with protected branches in a setting where you enforce pull requests and don't allow direct commits. There you are stuck and there is no way to identify with the correct email address in commits if you are committing with different email addresses to different projects.

A solution

The simplest way to solve the problem would probably be to allow to set an email address for web-based operations per organization. Then work commits would happen with the work email and personal commits with the personal email without any further complications. This would be very similar to the configuration of email addresses for notifications where it already works nicely.

This is a feature request for GitHub, in some configurations I would even say it's a bug because it basically renders parts of the web UI useless.

Is there a chance that we can get this fixed to make life of everybody easier who is contributing to multiple projects wearing different hats?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment