In this Article i m going to share the step by step guide to git clone in Windows Subsystem for Linux Ubuntu server.
First of all one of the major question is raised that is installing git is necessary to git clone in Windows Subsystem for Linux Ubuntu server.
Answer is –
No, installing Git within the Windows Subsystem for Linux (WSL) is not required in order to clone a Git repository. Without installing it within WSL, you may use Git via a GUI client or the Windows command prompt.
Nevertheless, you may install Git within WSL to clone repositories and carry out Git activities directly in that environment if you want to work in the Linux environment that WSL offers. If you wish to utilize Linux commands and tools, this could be useful.
How to clone git repository is WSL (Windows Subsystem for Linux) ?
Step – 1 : First go to the directory where you want to clone the git repo.
Step – 2 : you can directly run the git clone command if your ssh key is already set in the git hub.
git clone firstname.lastname@example.org:git-repo-for-your-project.git
These are the only steps for the git clone.
If your SSH key is not set in your github then follow the below process.
How to add SSH Key in your github in WSL (Windows Subsystem for Linux)?
Here are the steps to add your SSH Key in your github in WSL.
Step – 1 : Go to your root directory.
Step – 2 : Run this command to generate your ssh key for your github account.
ssh-keygen -t rsa -b 4096 -C "email@example.com"
Step – 3 : Run the command as follow, and then add the SSH key to the ssh-agent:
eval "$(ssh-agent -s)"
Step – 4 : Copy the contents of the public key (
id_rsa.pub) to your clipboard:
Step – 5 : Activate the duplicated key on your GitHub profile. Add a new SSH key by going to your GitHub account settings, selecting “SSH and GPG keys,” and then finish.
Step – 6 : Run the Below command to verify the connection to github:
ssh -T firstname.lastname@example.org
Step – 7 : Run your git clone command to clone any repo from github in WSL (Windows Subsystem for Linux).