1

I was troubleshooting why my commits were not showing up in my "activity calendar" on GitHub, and by looking at my commits which were not shown I realized it was using an e-mail address that I had not linked to my account.

However, what I don't get is where it got this e-mail address from. The e-mail it used is related to my internal username at my workplace, and basically has the structure username@user.workplace.com. I have never used this an e-mail address, I'm not sure if it actually works and I definitely have not provided this anywhere myself.

Running the suggested checks git config --global user.email and git config user.email show that the (supposedly) used e-mail address is my usual one which I intend to use. Also running echo $GIT_COMMITTER_EMAIL and echo $GIT_AUTHOR_EMAIL show that these are empty; however, trying to set them as suggested here does not work; it just says bash: GIT_*_EMAIL: command not found.

So it might be obvious to everyone but me, but where exactly does the (incorrect) e-mail address username@user.workplace.com live and how do I fix it? And why at all is it used in the first place?


Edit: I also get the following message:

Committer: My Name <username@user.workplace.com>
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly. Run the
following command and follow the instructions in your editor to edit
your configuration file:

    git config --global --edit

After doing this, you may fix the identity used for this commit with:

    git commit --amend --reset-author

The last line just brings to an editor in which I get to edit my most recent commit.

hejseb
  • 2,064
  • 3
  • 18
  • 28

1 Answers1

2

I was having the same issue when using Git via R Studio on Windows 7 Enterprise. In my situation the issue seems to be that Git accessed via the shell looks for .gitconfig in %HOMEDRIVE% whereas when accessing via R Studio it looks in %USERPROFILE%.

On my work system, %HOMEDRIVE% is mapped to a network drive (M:), whereas %USERPROFILE% points to a local folder, C:\Users\<my_username>.

My quick-n-dirty solution was to copy all of Git's dotted files from %HOMEDRIVE% to %USERPROFILE%. Just open up a couple of Explorer windows and enter the names %HOMEDRIVE% and %USERPROFILE% into the address bars and - assuming they are different for you - try copying the relevant files. I think that just copying .gitconfig would probably work, but I also copied the bash and vim config files as well to be on the safe side.

I suspect that a better solution would involve setting your system up so that all versions of Git look in the same place and just having these files in one location. I believe that that might require editing profile, which is found in C:\Program Files\Git\etc on my Windows 7 machine. This answer suggests that you should find a line in profile setting HOME="$HOMEDRIVE$HOMEPATH", though that wasn't in my profile: https://stackoverflow.com/a/2115116/4957167. (Reading the other answers to that question and seeing mention of both %HOMEDRIVE% and %USERPROFILE% was what tipped me off to try this.)

This question has more information on %HOMEDRIVE% and %USERPROFILE%: What is the meaning of these Windows Environment variables: HOMEDRIVE, HOMEPATH, HOMESHARE, USERPROFILE.

Community
  • 1
  • 1
jamse
  • 344
  • 2
  • 14