GitLab "HTTP Basic: Access Denied" on Push or Clone

Share
Workaround available Windows, macOS, Linux Updated November 13, 2026Based on 4 user reportsHow we research

Quick answer

GitLab no longer accepts account passwords for Git over HTTPS when 2FA is on or passwords are disabled. Use a personal access token with read_repository or write_repository scope as the password.

Most likely fix: Create a personal access token

How to fix it

Try these in order — the most common fix is first.

  1. 1. Create a personal access token

    1. Go to avatar > Preferences > Access tokens > Add new token.
    2. Tick write_repository (and read_repository), set an expiry, and copy the token once.
    3. Use your username and the token as the password.
    Did this fix it?
  2. 2. Clear cached credentials

    1. Windows: Credential Manager > Windows Credentials, remove git:https://gitlab.com.
    2. macOS: Keychain Access, delete the gitlab.com entry.
    3. Linux: git credential reject or delete the entry from ~/.git-credentials.
    Did this fix it?
  3. 3. Update the remote URL

    1. git remote -v to check the URL.
    2. git remote set-url origin https://gitlab.com/<group>/<project>.git.
    3. Some clients need oauth2:<token>@ in the URL.
    Did this fix it?
  4. 4. Check token expiry and project access

    1. Expired tokens fail with the same message.
    2. Make sure your user is at least Developer on the project, or the token belongs to a project access token with the right role.
    Did this fix it?
  5. 5. Switch to SSH

    1. Add an SSH key under Preferences > SSH Keys and use git@gitlab.com:<group>/<project>.git.
    Did this fix it?

Symptoms

git push or clone over HTTPS returns "remote: HTTP Basic: Access denied" and "fatal: Authentication failed" (sometimes shown as 401).

Why it happens

  • Account password used instead of a token
  • Token expired or revoked
  • Token missing read_repository or write_repository scope
  • Cached old credentials in the OS credential manager
  • 2FA enabled on the account

This guide also covers

  • gitlab http basic access denied
  • gitlab fatal authentication failed
  • gitlab 401 push
  • gitlab remote http basic access denied 2fa

Still not working?

If GitLab keeps failing, you're not alone. See every GitLab problem users report or the alternatives people switch to.

Have an app idea? Our small team builds any software: web and mobile apps, games, desktop, AI tools. Price agreed together.

Talk to us
Fixed it? Share this guide

Other GitLab errors

All 11 GitLab errors and fixes →