简体   繁体   中英

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

I have ssh -T git@github.com 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?

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 git@github.com:saumyaphilip/mgc_web.git

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM