1

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?

4
  • What is the repository? Commented Sep 1, 2022 at 5:17
  • @ewong it is a private repository git remote add origin github.com/saumyaphilip/mgc_web.git Commented Sep 1, 2022 at 5:22
  • Either you used the wrong pubkey or there is something wrong with your repo (permission wise) Commented Sep 1, 2022 at 5:25
  • 1
    Why did you obscure the part before @github.com: Permission denied (publickey).? That is, why the three stars there? You're required to use git here, so it has to read [email protected] to work, so there's no point in hiding the git part. Commented Sep 1, 2022 at 8:11

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.