Why Git Says 'Repository Not Found' When the Repo Actually Exists
Developers using multiple GitHub accounts on one machine may encounter a misleading 'Repository not found' error during git pull, even when the repository is accessible in a browser. GitHub deliberately returns a 404 instead of a 403 for unauthorized requests to private repos, to avoid leaking information about their existence. The root cause is typically a credential helper caching a token for the wrong account, causing git to silently authenticate with an identity that lacks access. On machines running the GitHub CLI, the fix is straightforward: use gh auth switch to activate the correct account, then run gh auth setup-git to update git's credential helper. Users without the GitHub CLI can resolve the issue by removing the stale credential from their operating system's credential store and re-authenticating on the next pull.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in