Learn / Git

Fix "Permission to OWNER/REPO.git denied" (403) on GitHub

GitHub knows who you are. It just will not let that account write to this repo. The fix is about your sign-in, not your code: no reset, no force push, no new clone.

The error

You run git push and see this:

remote: Permission to acme/shop-app.git denied to jey-personal.
fatal: unable to access 'https://github.com/acme/shop-app.git/': The requested URL returned error: 403

Read it slowly. acme/shop-app is the repo (owner, then name). jey-personal is the GitHub account Git signed in with. 403 is the web's code for “I know who you are, and the answer is no.”

A few words first

  • A remote is the address of the copy of your repo on GitHub. It is usually called origin.
  • HTTPS is one of the two ways Git talks to GitHub. Your remote starts with https://github.com/. The other way is SSH (git@github.com:).
  • A credential helper is a small program that stores your GitHub login and hands it to Git, so you do not type it every time. On a Mac this is often the Keychain. It can also be the GitHub CLI, gh.
  • Write access means an account is allowed to push to a repo, not only read it.

This is different from Permission denied (publickey), where GitHub could not tell who you are at all. That one has its own guide: Fix “Permission denied (publickey)”.

Check first (these commands change nothing)

git remote -v                                         # which repo am I pushing to?
gh auth status                                        # which GitHub accounts is gh signed in to?
git config --show-origin --get-all credential.helper  # who stores my login?

git remote -v prints the address twice, once for fetch and once for push:

origin	https://github.com/acme/shop-app.git (fetch)
origin	https://github.com/acme/shop-app.git (push)

If you use gh with two accounts, gh auth status lists both and marks the one in use:

github.com
  ✓ Logged in to github.com account jey-personal (...)
  - Active account: true
  ...
  ✓ Logged in to github.com account jey-work (...)
  - Active account: false

Find your cause

You findIt meansFix
The account in the error is not the one you meant (personal instead of work)Git signed in as the wrong accountSwitch account (next section).
The account is right, but the owner never gave it access (check with them, or look for a pending invitation in your email)That account has no write accessAsk the owner to add you, or fork and open a pull request.
The remote has a typo or points to someone else's repoYou are pushing to the wrong placegit remote set-url origin with the right address.
You push with a personal access token (a long password-like code you made on GitHub)The token cannot write to this repo, or it expiredMake a new fine-grained token with write access to this repo, and an expiry date.

The fix: sign in as the right account

If gh holds your login, switch the active account, then tell Git to ask gh:

gh auth switch     # with two accounts, it flips to the other one
gh auth setup-git  # make gh the helper Git asks for a login
git push           # try again

gh auth switch confirms the change:

✓ Switched active account for github.com to jey-work

With more than two accounts, name the one you want: gh auth switch --user jey-work.

If the Mac Keychain holds the old login instead, erase it. Type the first command, then the two lines, then press Return on an empty line. Nothing prints when it works. Your next push asks you to sign in again.

git credential-osxkeychain erase
host=github.com
protocol=https

Two accounts on one laptop?

If you keep work and personal accounts, you can tie one repo to one account by putting the username in its address. Git then asks the helper for that user's login only:

git remote set-url origin https://jey-work@github.com/acme/shop-app.git
git remote -v  # check the new address

Do not force push or reclone. The error happens before anything is sent. Your commits are safe on your laptop. Never paste a token into a chat, a ticket or a committed file.

Using SSH?

Over SSH the message says the same thing, followed by fatal: Could not read from remote repository. It means the SSH key you used belongs to an account without access. GitHub's fix: the repo owner adds that account as a collaborator, or to a team with write access. Or add your key to the right account. If the push gets through but is rejected (fetch first), read Fix “git push rejected (fetch first)”.

GitHub steps checked on docs.github.com on 24 November 2026. The Git and gh output above was reproduced in a test repo with Git 2.43 and gh 2.89.

From the book

Git / GitHub Study Guide

151 pages for beginners: every command explained, 4 local drills with a PASS or FAIL checker, 4 GitHub labs written as work tickets and GH-900 exam prep.