jeff
jeff

Reputation: 1020

GIT permission denied (publickey) - Fatal could not read from remote repository

I have ssh -T [email protected] command returning successfully authenticated.
I also have ssh-add -l -E sha256 returning output.

But git push -u origin main returns

***@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Can anyone help me?

Upvotes: 1

Views: 1319

Answers (1)

VonC
VonC

Reputation: 1323065

You are adding as a remote an HTTPS URL (https://github.com/saumyaphilip/mgc_web.git)

That means your SSH key is not used at all.

Try at least to switch to SSH:

cd /path/to/repository
git remote set-url origin [email protected]:saumyaphilip/mgc_web.git
                          ^^^

As noted, the SSH remote user is always git.

Upvotes: 1

Related Questions