When setting up Git Hub to work with VS Code there are a couple of potential issues you may encounter. These are fairly simple to resolve.
We will assume that you have a WSL 'machine' set up in Windows.
Before you can work with any of the Centiq repo's on Git Hub, you will need to ensure that you have an SSH key set up.
If you are not sure if you have an SSH key,
-
Start a WSL shell and connect to your WSL installation. (A simple way to do this is to use 'Start Menu>Run>WSL' in Windows).
-
Then look in the folder '.ssh' in your home directory. To do this use the following commands in the shell.
cd ~
cd .ssh
ls -alIf you have an SSH key then you will see that there will be two files:
id_rsa
id_rsa.pubThese are the private key (id_rsa) and public key (is_rsa.pub) files. You need to ensure that they are key safe so it is worth making a copy of them in a secure location.
If, having followed the steps in the previous section, you find you do not have an SSH key, then you can create one. Use this command from the WSL shell:
ssh-keygen -t rsa -b 4096Follow the prompts and once it has finished then it will produce the two id_rsa files we were looking for previously.
Once you have located the SSH key files, then you need to associate them with your Git Hub account. You can do this as follows-
- Log into Github in a browser.
- Click on your profile picture (top right hand corner), and choose 'Settings'.
- In the left hand menu select 'SSH and GPG Keys'.
- On the page that is shown, press the button 'New SSH Key'.
- Give the key a descriptive title.
- Paste in the entire contents of the id_rsa.pub file, including any comments.
- Press 'Add SSH Key'
Once you are done the key should be listed.
Once you have a key uploaded to the Git Hub then you can verify that the connection is working and that your key is recognised.
- Start a WSL shell.
- Use the following command -
ssh -T git@github.comYou should see a message telling you the public fingerprint of the server you are connecting to, and, if your key was password protected, it may prompt you for the password of your SSH key. Here is a some typical output from the command:
The authenticity of host 'github.com (140.82.121.4)' can't be established.
ECDSA key fingerprint is SHA256:ABCDEFGHIJKLMNOPQRSTUVWXYZ.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'github.com,140.82.121.4' (ECDSA) to the list of known hosts.
Enter passphrase for key '~/EXAMPLEUSER/id_rsa':
Hi EXAMPLEUSER! You've successfully authenticated, but GitHub does not provide shell access.
If you have problems with the connection test appearing to hang when it is performed see ssh-connection-problems for remediation.