git clone's Examples

This command is used to make a copy of a repository from an existing URL. If I want a local copy of my repository from GitHub, this command allows creating a local copy of that repository on your local directory from the repository URL.

git clone Repo_URL

Clones an existing repository

$ git clone [repository-url]

Testing

git clone https://github.com/URL-TO-REPO-HERE

testing

$ git clone <repository URL>

testing

git clone <repo> <directory>

git clone test.git

git clone test.git

Clones the git directory

git clone

Clone a remote repository

git clone https://github.com/user/repo.git

Clone into a specific folder name

git clone https://github.com/user/repo.git my-folder

Clone specific branch only

git clone --branch dev https://github.com/user/repo.git

Shorthand for --branch

git clone -b staging https://github.com/user/repo.git

Shallow clone with limited commit history

git clone --depth 1 https://github.com/user/repo.git

Clone only one branch (no all branches)

git clone --single-branch -b dev https://github.com/user/repo.git

Clone a repo including submodules

git clone --recursive https://github.com/user/repo.git

Mirror entire repo including all refs and hooks

git clone --mirror https://github.com/user/repo.git

Clone without a working directory (for hosting)

git clone --bare https://github.com/user/repo.git

Use a custom Git template directory

git clone --template=/path/to/template https://github.com/user/repo.git

Set a custom remote name (default is origin)

git clone --origin upstream https://github.com/user/repo.git

Set config values while cloning

git clone --config core.autocrlf=true https://github.com/user/repo.git

Clone via SSH (requires SSH key setup)

git clone git@github.com:pritesh-1904/demo.git

Clone/download an existing repo.

git clone https://github.com/pritesh-1904/repo.git

DevOpsSchool
Typically replies within an hour

DevOpsSchool
Hi there 👋

How can I help you?
×
Chat with Us