Skip to content

Instantly share code, notes, and snippets.

@shuch
Forked from stormwild/vscode-git-integration.md
Created February 16, 2023 13:57
Show Gist options
  • Select an option

  • Save shuch/d2702c8009f34dd75a8924883a32520f to your computer and use it in GitHub Desktop.

Select an option

Save shuch/d2702c8009f34dd75a8924883a32520f to your computer and use it in GitHub Desktop.
Allow Visual Studio Code to Push to Remote Repository

Visual Studio Code Git Integration

If you're using Mac OS (High Sierra or otherwise) you might have seen this error when you tried to push git code (to GitHub), especially if you tried doing so from something such as Visual Studio Code (vscode):

> git push
[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.

Thankfully, the solution is extremely simple. All you have to do is create (or edit) a ~/.ssh/config file and add the following:

~/.ssh/config

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

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment