3

I am facing problem while trying to connect to GitLab remote repo through SSH here are the steps done so far:

  • Successfully generated SSH keys
  • Administration added the keys to the repo, so when I am on GitLab website, I am able to commit and publish branches

I can't publish branches from VSCODE and getting the below error and I am using MAC.

Permission denied (publickey).
fatal: Could not read from remote repository.
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Does this answer your question? [How to solve Permission denied (publickey) error when using Git?](https://stackoverflow.com/questions/2643502/how-to-solve-permission-denied-publickey-error-when-using-git) – Arty-chan Jan 02 '21 at 07:12

2 Answers2

2

so when i am on gitlab website i am able to commit and publish branches

That has nothing to do with your local SSH key.

Test first on your local computer (Mac) if your key is working with:

ssh -Tv git@gitlab.com

That will try and use your ~/.ssh/id_rsa private key, which means your ~/.ssh/id_rsa.pub public key must have been registered to your SSH profile GitLab account first.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
1

on Windows I faced similar issue. Was not able to checkout from Gitlab using open in VS Code option

For that, Just Open VS code using 'code' command in git bash. As per VS Code official documentation, doing so will inherit SSH environment. (from official VS Code docs)

I was facing issues when doing Gitlab -> clone -> open in your IDE -> VS code SSH.

opening VS code using a git bash solved the issue

Safnas
  • 144
  • 1
  • 11