Kaisin Li
Kaisin Li

Reputation: 534

Terminal keeps pushing from wrong GitHub account

I have two GitHub accounts, kaisinli and somefakeaccount. I want to push from kaisinli but every time I try to do anything, it shows up on GitHub that somefakeaccount has made the commit. And the contributor list for that repo would only have somefakeaccount.

For example, I would create a repo on kaisinli, follow through their steps and whatnot to create a local repo. After I push README, I check back on GitHub and I'll see somefakeaccount making that commit.

I've tried resetting SSH keys and follow all the tutorials I could find on the internet and nothing has helped so far.

What else can I do? How do I remove somefakeaccount from that repo and set it back to kaisinli?

Upvotes: 0

Views: 208

Answers (2)

Renil Babu
Renil Babu

Reputation: 2357

I would suggest you to go and take a look at your config file

vi ~/.gitconfig

And take a look at the user and email mentioned in there. Make sure the user and email you mentioned in this file is the one you want to push your repo from aka your github user.

If you push from multiple machines, keep in mind to change the configuration file on every machine.

Hope this helps

Upvotes: 1

Shalec
Shalec

Reputation: 172

Did you considered the github-helpcenter? ( https://help.github.com/articles/why-are-my-commits-linked-to-the-wrong-user/ ) They describe your issue.

If your commits are linked to another user, that means the user has added the email address in your local Git configuration settings to their GitHub account. In this case, you can change the email in your local Git configuration settings and add the new email address to your GitHub account to link future commits to your account.

1

To change the email address in your local Git configuration, follow the steps in "Setting your commit email address in Git". If you work on multiple machines, you will need to change this setting on each one.

2

Add the email address from step 2 to your account settings by following the steps in "Adding an email address to your GitHub account".

Commits you make from this point forward will be linked to your account.

Upvotes: 0

Related Questions