I have a work computer where $HOME/.gitconfig
has user.email
to RotatingPieces@work.tld
. My home computer has $HOME/.gitconfig
has user.email
to Rotating.P@SuperKawaiiAnimeWeb.net
. And there is the virtual machine with R.Pieces@DogeMemes.net
. And the laptop has... .
These e-mail addresses are correct for most of the repositories cloned on these machines. But sometimes I do mix up what I am doing on what machine. Doing work stuff at home and the other way around.
So when I do something in my public GitHub/BitBucket/GitLab/Whatever repository at I then commit as RotatingPieces@work.tld
. Working from home creates commits as Rotating.P@SuperKawaiiAnimeWeb.net
. Because of this I accidentally link these two e-mail addresses together. It happens by accident all the time.
Is there some way to stop this? What can I do to stop myself from leaking my e-mail addresses when working on the same repository on different machines?
Things that don't work:
- Changing
$HOME/.gitconfig
files. These e-mail addresses are correct for most of the repositories cloned on these machines. - Using
git commit --author=...
. I would forget the--author
option all the time. - Setting an e-mail address in
.git/config
of the cloned repository. This only works for this machine for this repository. I would have to remember that for every time I make a new clone of a repository. Too easy to forget.
The best solution would be a server-side or client-side commit hook that you can just commit into a repository which then is run by git. Or some hook or e-mail address filter I could activate in the GitHub web UI. However such a thing probably doesn't exist for obvious abuse reasons.
Anyone got any ideas for a solution?