2

I have 2 github accounts, one for personal use and one for work.

I am working on a personal website and so I have logged into git from the terminal using my personal username and password. When I do a 'git config --list' I am shown the correct username and password for my personal account as I would expect.

However when I then try and push my code up to my personal account it gives this error...

remote: Permission to <personal_username>/<personal_repo>.git denied to <work_username>.

I have no idea where it is even picking up my work username or work credentials from as they are not listed in my git config.

Please help!

Thanks

1 Answers1

0

If the URL is an HTTPS one, check your git config credential.helper: if manager, if would have cached, you need to reject its URL

git credential-manager reject 
protocol=https
host=github.com
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Where do I put that code sorry? I've run a 'git config -l' and my work credentials aren't even showing there so I don't know where the computer is picking them up from anymore – brianmcgowan Jun 18 '20 at 10:00
  • @brianmcgowan credentials have nothing to do with git config. That command is to be typed in a bash or CMD, then you type `protocol=...` and `host=...`. What OS are you on? With which version of Git? – VonC Jun 18 '20 at 10:38
  • git version 2.17.2 (Apple Git-113) and I am using a Mac – brianmcgowan Jun 18 '20 at 13:02
  • @brianmcgowan OK. Could you upgrade to 2.27? – VonC Jun 18 '20 at 13:08