Post Contents
# Requirements
- Git installed in your system. Download
All of the git hosting providers provide two URLs of cloning repository. The first one is the usage of HTTPS and the second one is the use of SSH. With the usage of HTTPS as a cloning URL, you need to enter credentials every time you want to push for your branch. That can be solved with using SSH as a cloning URL.
# Cloning with HTTPS
Open any of git hosting provider. I’m using github for this tutorial. After logging into your account, click on any repository. You will find Clone Or Download button. Copy Clone with HTTPS URL, and use following command, wherever you want to clone repository.
git clone <url>
/* Example: git clone https://github.com/username/test.git */
With using above command you will get repository in your local machine.
# Cloning With SSH (Recommended)
Keep in mind that using SSH as a cloning URL, you must need an SSH key. You can get rid of entering credentials every time using this method.
git clone <url>
/* Example: git clone git@github.com:username/test.git */
# Cloning Into Specific Folder
Git creates a folder named the same as a repository by default. But sometimes, you need to clone a repository in a specific folder. You can achieve that by the following command.
git clone <url> .
# Cloning Specific Branch
You can also clone a specific branch with following command.
git clone -branch <branch-name> <url>