我有ssh -T git@github.com
命令返回成功验证
我还有ssh-add -l -E sha256
返回输出。
但git push -u origin main
返回
***@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.
有人能帮我吗?
您正在添加HTTPS URL作为远程URL(https://github.com/saumyaphilip/mgc_web.git)
这意味着您的SSH密钥根本没有被使用。
尝试至少切换到SSH:
cd /path/to/repository
git remote set-url origin git@github.com:saumyaphilip/mgc_web.git
^^^
如前所述,SSH远程用户始终是git
。