Home » How to Clone a Git Repository

How to Clone a Git Repository

To clone a git repository, you must first have Git installed on your computer. If Git is properly installed, you can begin cloning your first Git repository.


Clone Git Repo using URL

To clone a Git Repository using the URL run the below command.

git clone <git_url>


git clone https://github.com/projectxyz.git

Clone Git Repo to Specific folder

Execute the git clone command and specify the destination folder at the end to clone a git repository into a specific folder.

git clone <git_url> <destination_folder>


git clone https://github.com/similargeeks/task.git task_folder

In above example task_folder is a destination folder where the project called task is stored.

Clone specific branch in Git Repo

To clone a specific branch, run git branch with the -b option and specify the branch you wish to clone.

git clone -b <branch_to_clone> <repo_url>

Example: Consider my_branch is the branch of the given repo.

git clone -b my_branch https://github.com/similargeeks/task.git

Also Read:

Check the Git version