1

I used have a "work" GitHub account.

Everything works fine, and I have no trouble pushing code etc to my work account.

Then I created a personal Github account to use for my personal portfolio on GitHub pages.
When I try to push to my personal account, I get the error:

Permission to
mypersonalaccountusername/mypersonalaccountusername.github.io.git
denied to mycompanyusername

I expected git to ask me for my username, but somehow it assumes that I am trying to push with my company username. No idea what's going on.
Github Desktop is signed into mycompanyusername, but for my personal Git repository I am trying to push from the terminal by doing:

git push -u origin master

So how can I push to my personal repository from my personal account instead of my company account?

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
Rahul Iyer
  • 19,924
  • 21
  • 96
  • 190

1 Answers1

0

That depends on your remote origin URL: SSH (git@github.com:...) or HTTPS (https://github.com/...), used by GitHub Desktop.

  • for SSH: check your ~/.ssh/id_rsa(.pub) keys (if the public key is registered to your first account, said account will be used).

  • In the latter case, check our git config credential.helper output: the credentials manager could cache the wrong credentials ("mycompanyusername" for github.com).

If it is "manager", you can "sign out in the Git Bash console in Windows".

git credential-manager reject https://github.com

On Mac, for osxkeychain, see "Updating credentials from the OSX Keychain"

git credential-osxkeychain erase https://github.com

Then try again: it will prompt for user GitHub username/password.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250