Search code examples
gitgithubgit-commit

Github sends email notification with different username upon my commit


My actions

I recently created a new branch, made some commits (a simple git commit -m), and created a pull request in a repo that was not created by me. Github correctly recognises my username/email from ~/.gitconfig, but sends email notifications containing the wrong username.

# This is Git's per-user configuration file.
[user]
# Please adapt and uncomment the following lines:
name = ddelange
email = [email protected]

The results

As can be seen below, the commits are linked to me (as expected). Running git show 2f74892 also looks as expected. Commits are received correctly so it seems


However

Then, all people involved receive an unexpected email from [email protected], attributing my commit to the owner of the repo: Email containing wrong username


These emails are sent every time I git push. Anyone ideas what's happening here?


Solution

  • So I contaced Github support as Justin Howard suggested. This was their response:

    Hi there David,

    Thank you for getting back to us with that.

    I had a look at our logs for the repository and I do show @yrik pushing that commit.

    We're attributing them to your account as you have your user.email set correctly but Git is authenticating as the other user. This is probably because you have that user's credentials cached in Keychain.

    Can you follow the steps below and let me know if that helps you to resolve this?

    https://help.github.com/articles/updating-credentials-from-the-osx-keychain

    Thanks, Steve

    Removing (my) credentials from the keychain, and logging into git cli again with 2fa stopped the erroneous notifications.

    Since I have notifications for "my own activity" disabled, and I'm not watching the repository otherwise, I now don't get notifications anymore when I push commits, and other watching users receive correct email notifications.