Git appears to come as standard as part of the WSL install. You can test this by running:
$ git --versionIf for some reason Git is not installed then you can simply pull it down:
sudo apt-get update
sudo apt-get install gitgit config --global user.name "Shiva Poudel"
git config --global user.email "[email protected]"
git config --global core.autocrlf falseAdditionally, follow this documentation to generate new SSH key and add it to your GitHub account.
If you have an configuration and SSH key already setup on Windows you could reuse it rather than creating a new one. (Note that PuTTY keys do not work here). To do this you can just copy the key from the Windows filesystem into the WSL's filesystem. Linux has some rules about how visible the key is. So you need to make sure the access levels are strict enough to meet these requirements:
cd ~
cp /mnt/c/Users/shiva/.gitconfig .
cp /mnt/c/Users/shiva/.gitignore_global .cd ~
mkdir .ssh
cd .ssh
cp /mnt/c/Users/shiva/.ssh/id_ed25519* .
# Fix **WARNING: UNPROTECTED PRIVATE KEY FILE!**
chmod 600 * # Check the permission with `stat -c "%a %n" *`
For copying ssh key in Github on WSL2.