NaingMinZaw
NaingMinZaw

Reputation: 101

Permission denied (publickey) & Please make sure you have the correct access rights and the repository exists

I try to create new repository using command but the following error occurs, how can I resolve this?`my window is windows-7 pro

       PS C:\Users\Naing Min Zaw\Desktop\learningGit> git push -u origin main
       [email protected]: Permission denied (publickey).
       fatal: Could not read from remote repository.

      Please make sure you have the correct access rights
      and the repository exists.

I use this command in powershell

git init
git add .
git commit -m "first commit"
git branch -M main
git remote add origin [email protected]:NaingMinZaw/learningGit.git
git push -u origin main

Upvotes: 0

Views: 304

Answers (1)

VonC
VonC

Reputation: 1327014

Check the output of

git -c "core.sshCommand='ssh -Tv'" push -u origin main

That will show you which SSH key is looked up by SSH during the push.

If you don't have an SSH key, generate one and add the public key to your GitHub profile.

Upvotes: 1

Related Questions