How to fix Fatal: Repository not found error on Mac (Github, VS Code)

While trying to push something to Github, I encountered repository not found/operation timed out errors.

I had slightly different errors on VS Code and my regular terminal.

on VS Code

remote: Repository not found.
fatal: repository 'https://github.com/user/repo.git/' not found

Screenshot of Git Github error: fatal: repository 'https://github.com/user/repo.git/' not found

On my regular terminal

fatal: unable to access 'https://github.com/user/repo.git/: Failed to connect to github.com port 443: Operation timed out.

Screenshot of Git Github error: fatal: repository 'https://github.com/user/repo.git/' not found

How to fix it.

From what I noticed, this issue seems to be caused if you are using more than 1 Github account. So the key chain gets messed up.

To fix this issue

  1. Open up Spotlight search (command + spacebar) and search for “Keychain Access”.
  2. In here, search for “github”. Delete everything related to github.
  3. Completely quit VS Code or your terminal (depending on what you use).
  4. Running git push origin master (or whatever you use) should now ask you to log in, and it should work.

That should fix it.

I hope this helps.

Want to learn how to code and make money online? Check out CodingPhase (referral link)