Home > Net >  how to do "git clone" on VS code
how to do "git clone" on VS code

Time:07-23

Today, I am following this video https://www.youtube.com/watch?v=RGOj5yH7evk to learn how to use GitHub, but I am using Windows.

I've set it all successfully by also following the official instruction (https://docs.github.com/en/authentication/connecting-to-github-with-ssh/about-ssh) and it works on Git Bash. enter image description here

But I failed when I tried to "git clone" in Visual Studio Code and got this response:

[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.

I've also tried setting the config because the video mentioned config (although the official instructions does't mention this, which means Windows users don't need to care about this. But this was what I tried to solve the problem, just in case this could make influence on my problem)

file:C:/Users/CC2022/.gitconfig  user.name=CC
file:C:/Users/CC2022/.gitconfig  [email protected]
file:C:/Users/CC2022/.gitconfig  core.editor='C:\Users\CC2022\AppData\Local\Programs\Microsoft VS Code/Code.exe' -multiInst -notabbar -nosession -noPlugin

So, is there any requirement for the folder I select to open in VS code to do the git stuff or where is the problem?

Thank you for your help

CodePudding user response:

clone@github:~/.ssh$ ssh-keygen -o -t rsa -C “[email protected]

check it out your key.

CodePudding user response:

I can git clone by the HTTP link on both VS code and GitBash, or git clone by the SSH link on Git Bash.

But I have a problem (git clone by SSH link) on VS Code.
In addition, although git clone by HTTP link on VS Code is okay, but I cannot "push" edited files back to GitHub, because the access is denied

That means the repository you are trying to push back to is not one you own/have created. You might therefore have no right to contribute back to it directly.

  • Related