Recently I did a fresh install of Ubuntu 20.04 via WSL2 (which i don't love yet but its growing on me), and I had to do the following steps to set git up:
1.Install git (duh!)Im just putting it here for completion sake
sudo apt-get update sudo apt-get install git
2. Add ssh keys
You have to add your desired keys to your ssh agent, found this on Stack overflow and many other places.
eval $(ssh-agent) ssh-add
These commands permanently add your ssh keys to your keychain and will skip having to ask the passphrase any time you want to clone a repository via git.
3.Update git config.
Due to recent updates to github's git protocol implementation (implemented as of January 11 2022) , it is not enough to add ssh keys (RSA, DSA are deprecated), you have to change your local git configuration (nice explanation on Stack Overflow):
git config --global url."[email protected]:".insteadOf git://github.com/