# fatal: Authentication failed for 'https://github.com/x/y.git/'

**Code:** `Authentication failed` · **Category:** Git · **Seen on:** Git

HTTPS authentication to the Git host failed — wrong or expired credentials, or a password used where a token is required.

## Meaning

GitHub, GitLab and Bitbucket require personal access tokens (or OAuth via a credential manager) instead of account passwords for HTTPS. Stored credentials may be outdated.

## Common causes

- Account password used instead of a token
- Expired/revoked token
- Cached old credentials
- Token missing scopes

## Quick fix

1. Create a personal access token and use it as the password
2. Clear cached credentials
3. Use GitHub CLI: gh auth login
4. Switch to SSH

## Detailed fix by platform

### Git

1. `gh auth login && gh auth setup-git`

## How to diagnose

1. **Credential** — Token or password?
2. **Cache** — Which credential is stored?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/git/authentication-failed)
