0

Problem:

I cant get the correct username to show up for commits on github.

Background:

I first had a Github account for personal use that was just to mess around and become familiar with it. Now I'm in a college course that required me to create a new Github account. We are using pycharm for python programs in my class. When I commit and push to my repository on my new Github account the commit log shows my personal account username.

Attempts To Fix:

I've tried the:

git config --global user.name "yourname"

then I tested that the username was correct with:

git config --global user.name

I did the same with email and password to see if that made a difference. When that didn't work I looked around on google to see what I could find. People said to remove and re add credentials with the windows credential manager. I did that too and still no luck.

I'm willing to delete my personal account if that's what needs to be done I just need this second account to show the correct username when pushing because the professor won't grade the code unless you use your school username.

I appreciate any feedback.

1

As far as I know, github performs the comparison of the user via the e-mail address.

So try:

Go to Github.com -> Setting -> E-mail Add the Email address you used in your .gitconfig to your account.


Additional you can do conditional commits

Conditional Git Config

Your global git config .gitconfig

[user]
  email = priv-mail@example.com

# on Windows for all directories below p:/cy/* use the .corp.gitconfig config
[includeIf "gitdir/i:p:/cy/**"]
  path = ./.corp.gitconfig

Your secondary git config .corp.gitconfig

[user]
  email = corp-mail@example.com

you can test if the right config value ...

git config --show-origin --get user.email

The official documentation can be found here

| improve this answer | |
  • The top part of this was the fix for my problem. I retried entering my username email and password back into the git config global and it works now somehow. Thank you! – Cryoexn Sep 2 '19 at 15:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.