csci430-os / vscode-remote-devcontainer

Basic container and instructions/procedures to set up VSCode Remote Dev Containers for assignments / labs
7 stars 1 forks source link

Git clone fails in VSCode even though student believes ssh key correctly configured #4

Open DerekHarter opened 2 years ago

DerekHarter commented 2 years ago

Steps to Reproduce

I have not reproduced this exactly. But some students at times get an error in GitHub trying to clone their repository. I have not captured the exact error message on this failure. This should only happen for students the very first time they try to clone a repository on their system from GitHub, e.g. students who have not used git or GitHub before and are doing it for the very first time.

Description

I have not confirmed this is happenning yet. But in cases where I have seen this, I have directed students to open up a regular command line terminal on their local host system, and do the git clone by hand from the command line. It appears that they get the usual message for a first time access of GitHub, something like "unknown host, do you want to trust github.com". You normally get this the first time connecting to a site with git remotely, and if you confirm it remembers the site ssh fingerprint or similar associated with this host, so it can detect if this changes (man in the middle type attacks I believe).

Fix

Direct the student to open up a command line terminal, and clone the needed git repository by hand.

$ cd /home/user/repos
$ git clone ssh-url
Receive message that the site is not known, do you want to add it in as a known site.  Answer 'yes' here.

If they do have their ssh key correctly generated and added to GitHub or the remote git server, then the clone will work after they validate that this is a known site they are connecting to.

The student can then just do an "open folder" of the repository that was just cloned in VSCode.

And if I am correct about this, for some reason VSCode doesn't give the user a chance to see this and answer yes for a first time connect to an unknown git server site using ssh. But once you have added this as a valid site, then git clones will work in VSCode as well.