</>
Skip to content
Git lessons (7/44)

Git — Clone

Basic Clone

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

Clone to Specific Directory

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

Clone Specific Branch

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

Clone with SSH

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

Shallow Clone

# Clone only latest commit
git clone --depth 1 https://github.com/user/repo.git

Clone Submodules

git clone --recurse-submodules https://github.com/user/repo.git

After Cloning

cd repo
ls -la
git status
git log

Remote URL

# View remote
git remote -v

# Change URL
git remote set-url origin https://github.com/user/new-repo.git

Mini Practice

  1. Clone a repository
  2. Explore the cloned repo
  3. Check remote URL
  4. Clone specific branch

Up Next

Continue with Status — checking file status.

Related Topics

Frequently Asked Questions about Clone

What is Clone in Git?

Clone is a fundamental concept in Git. This lesson explains it step by step with clear examples, making it easy for beginners to understand.

How do I learn Clone?

Start by reading the explanation above, then try the code examples. Practice by modifying the examples and experimenting with different values. Hands-on practice is the best way to learn Clone.

Why is Clone important in Git?

Clone is essential for Git development. Understanding this concept will help you write better code and solve real-world problems more effectively.