To use SSH keys with GitHub or Bitbucket from WSL, create a key inside your Linux distro with ssh-keygen, load it into the SSH agent, add the public key to your Git service, then clone with the SSH address. Keys made in WSL stay in WSL; Windows has its own, separate set, covered in SSH Keys for GitHub on Windows.
Run everything below in your WSL terminal. My screenshots are from 2020 with Bitbucket; GitHub works the same way.
Create the Key
# Change the email to yours. Press Enter to accept the default file, then set a passphrase ssh-keygen -t ed25519 -C "you@example.com"
Ed25519 is what GitHub recommends today, and Bitbucket supports it too. In 2020 I used RSA (-t rsa -b 4096), which still works, and saved the key under its own name:

The default file is ~/.ssh/id_ed25519 (private key, never share it) and ~/.ssh/id_ed25519.pub (public key, the one you give to GitHub or Bitbucket).
Load It Into the SSH Agent
# Start the agent and add the key. Use the file name you chose above eval "$(ssh-agent -s)" ssh-add ~/.ssh/id_ed25519

The agent remembers your passphrase for as long as that terminal is open, so you type it once per terminal instead of on every git pull. If you named the key something else, as I did in the screenshot, use that name on the ssh-add line.
Add the Public Key to GitHub or Bitbucket
cat ~/.ssh/id_ed25519.pub

Copy the whole line, from ssh-ed25519 to the end, and paste it into your Git service: in GitHub that is Settings > SSH and GPG keys > New SSH key, and in Bitbucket Personal Bitbucket settings > SSH keys.

Then test the connection:
# GitHub ssh -T git@github.com # Bitbucket ssh -T git@bitbucket.org

The first time, type yes to trust the host. A message with your username means it worked.
Clone and Start Working
Copy the SSH address from the repository page (it starts with git@, not https://) and clone it into your Linux home folder:


cd ~ git clone git@github.com:your-name/your-repo.git cd your-repo code .


Keeping the repository in the Linux filesystem rather than under /mnt/c is what keeps Git fast; why is in Open WSL Files in Windows File Explorer. For a repository you already cloned over HTTPS, switch it to SSH. If Git is not on the Windows side yet, Install Git on Windows covers it, and Link Windows Files and WSL shows how to reach the same files from both sides.
If SQL Server is part of your day job, my current work lives over at sqldba.blog: production DBA scripts, an error library and the SSMS guide.