1

I'm trying to use Visual Studio Code Push/Sync to Git. I've created SSH Key and added it to my GITHUB account. When I try to push, I keep getting this error notification:

Permission denied (publickey).

fatal: Could not read from remote repository.

I've tried it from my private computer, and had there no problems at all. But from my work computer- where I have no admin rights, it just won't work.

I've found this answer, but still no help.

Have anyone any idea how can I make it work?

Community
  • 1
  • 1
Gilad.T
  • 115
  • 2
  • 9
  • Have you created a key-pair on **each** computer, and registered **each** pair's public key with GitHub? – Oliver Charlesworth Nov 26 '17 at 20:45
  • @OliverCharlesworth Yes. Each computer has it's own key. I must add that if I push from terminal it works. Only the VSCode Sync/Push option won't... – Gilad.T Nov 26 '17 at 20:49

1 Answers1

2
  1. make sure you used "git clone“ with the SSH Url and not HTTPS Url

  2. just to make sure, you can copy again your public key with this command to you Remote Repository „pbcopy < ~/.ssh/id_rsa.pub

  3. Check your git config username und email with your Remote Git Provider (e. g. Beanstalk, Github etc.) „git config user.email“ und „git config user.name“ and correct if necessary. „git config user.email <YourEmail>“ „git config user.name <YourUsername>

  4. Add Identity Using Keychain “ssh-add -K ~/.ssh/id_rsa” Just type in your password one more time after this.

You can see the change now in your ~/.ssh/id_rsa (if you want).

Should work after this.

Birol Efe
  • 1,605
  • 16
  • 14
  • Thanks @efebirol . Turned out that since I have no admin, I've also had to manualy add 'git\bin' path in my environment variables... – Gilad.T Jan 19 '18 at 08:19