Unrecognized author in commits

My commits are not linked to my Github account for some reason. I have set my e-mail in the git config to the primary email that is associated with my Github account, which should be the solution to this problem according to [this page](https://docs.github.com/en/free-pro-team@latest/github/committing-changes-to-your-project/why-are-my-commits-linked-to-the-wrong-user#:~:text=Unrecognized%20author%20(no%20email%20address,to%20link%20your%20future%20commits.)

But this is not the source for the problem. This is what I currently get for my commits:

Edit: For some reason this doesnt link to the actual commit.

I did choose to ‘keep my email adress private’, but I doubt that’s related to the problem. Unfortunately I cannot find a possible solution in the Github help pages. Can anybody here maybe help?

Edit: When I look at git log there is no email associated to my commits.

Author: b-naber <bn @MacBook-Pro-42.fritz.box>
Date: Sat Nov 21 15:44:06 2020 +0100

But this is my gitconfig file:

[user]
name = b-naber
mail = Same-email-as-in-github-account
[credential]
helper = osxkeychain

Setting the email address in git config does not change already existing commits. To do that you have to update the existing commits, either manually by using git rebase -i and editing the affected commits, or with git filter-branch. Both approaches are described here:

Note that if you use the manual approach (with rebase and git commit --amend) you’ll need to also use --author or --reset-author to actually change the author data.

Thanks a lot for your answer. For some reason using git config or editing the .gitconfig file did not change the email address, even in commits that were made after the e-mail address was changed. However, setting environment variables did solve the problem:

GIT_COMMITTER_EMAIL=your_email@abc.com GIT_AUTHOR_EMAIL=your_email@abc.com

That sounds like the email setting is overridden somewhere else. You can check in which files it is set by running the following command in your repository:

git config --show-origin user.email

If all of that looks correct, the only other thing I could think of is checking if GIT_AUTHOR_EMAIL and GIT_COMMITTER_EMAIL might already be set in your environment.

I get no output when I run that command. I assume that means the user.email was never set?! Then why do I still have an email address set in gitconfig and why doesn’t running git config --global user.email my email yield to output of the --show-origin command later? This is kind of weird behaviour… but it works now using the environment variables. Thanks for your help.

It’s really odd that the setting doesn’t stick, I’ve never encountered that before. You could try describing the setup you’re using, maybe someone else who’s using a similar one has an idea.