How to clone a repository in Git
In this tutorial, we are going to learn about how to clone a remote GitHub repository in git.
Cloning a remote repository
To clone a remote repository, open your terminal and run the git clone command followed by your remote GitHub repo https url.
Example:
git clone https://github.com/saigowthamr/gatsbyblog-starter.gitThis above code command will clone a gatsbyblog-starter directory in your local machine.
Note: You can find repository
https urlby clicking theclone or downloadbutton inside the GitHub repository.
Cloning repository into a specific folder
To clone a repository into a specific folder, we need to add a folder name after the https url.
Example:
git clone https://github.com/saigowthamr/gatsbyblog-starter.git magic
# magic is a folder nameThis above command will clone a gatsbyblog-starter directory into a magic folder in your local machine.
Cloning repository into the empty folder
If you want to clone a repository files into the empty folder you already created in the local machine, instead of using a remote repository folder name follow the below steps.
- Navigate to the empty folder inside the terminal.
cd wake- Now, add a dot
.after thehttps url.
git clone https://github.com/saigowthamr/gatsbyblog-starter.git .This command will clone a gatsbyblog-starter files into the wake folder.


