VS Code get permission denied (publickey) – Mac

Erik Larsson – April 13, 2020

fatal: Could not read from remote repository.
Please make sure you have the correct access rights

Do you get this error when trying to push or pull in the built-in VS Code Git Manager on Mac OS (High Sierra or other versions)?

There an easy solution to this problem, you need to tweak the permissions on your public key. To fix this problem you need to open your terminal. Input the following.

nano ~/.ssh/config

Paste in the following to the terminal

Host *
  AddKeysToAgent yes
  UseKeychain yes
  IdentityFile ~/.ssh/id_rsa

Then save the config file (Cmd + O to write to the file and then Cmd+x to exit)

You are all done! When you do a new push or pull it will work like a charm.

Note if your id_rsa file (pub key) has another name, just edit the IdentifyFile path.

Check out how we can improve your WordPress Hosting


Similar articles