Mac – Permission denied (publickey) – Cannot not read from remote repository

I tried cloning my project from github. I am getting the following error in my mac during the cloning process.

Permission denied (publickey) fatal - Could not read from remote repository. 

i have already added the ssh key to my github account .

>Solution :

Try following these steps

Step 1:

create a new ssh key:-

ssh-keygen -t ed25519 -C ""

Step 2:

copy the ssh key on clipboard :-

pbcopy < ~/.ssh/ 

Step 3:

now paste copied ssh key to the corresponding git repository

Step 4:
Start the ssh-agent in the background.

$ eval "$(ssh-agent -s)"
> Agent pid 59566

Step 5:
now try accesing the repo

git clone

Step 6:

if still you see the issue then check the ssh config file

vim ~/.ssh/config

the content should look like

  AddKeysToAgent yes
  UseKeychain yes
  IdentityFile ~/.ssh/id_ed25519

Step 7:

Add your SSH private key to the ssh-agent and store your passphrase in
the keychain

ssh-add --apple-use-keychain ~/.ssh/id_ed25519

Step 8:

Now try again it should work

git clone

Leave a Reply