`fatal: Authentication failed for 'https://github.com/org/repo.git/'` with a token that worked last month.
BeginnerTroubleshootingAuthentication and Remote Access
Answer
Likely causes → The token expired or was revoked, a stale token is cached by the credential helper, or the token lost access to the repo.
Diagnose →
git config --get-all credential.helper
GIT_CURL_VERBOSE=1 GIT_TRACE=1 git ls-remote origin 2>&1 | tail -20
Fix → Remove the cached credential (printf 'protocol=https\nhost=github.com\n\n' | git credential reject), create a new token, and retry so the helper stores the new one.
Prevent → Prefer SSH or gh auth over long-lived tokens, and calendar token expiry dates.
More on Authentication and Remote Access
`[email protected]: Permission denied (publickey).` followed by `fatal: Could not read from remote repository.`Beginner`remote: Support for password authentication was removed on August 13, 2021.`Beginner`WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!` when connecting to GitHub over SSH.Intermediate`remote: Repository not found.` for a repo you can open in the browser.Beginner`ssh -T [email protected]` says "Hi someone-else!" but you need your work account.Intermediate`ssh: connect to host github.com port 22: Connection timed out` on a corporate or hotel network.Intermediate