Loading

Quipoin Menu

Learn • Practice • Grow

git / Clone a Repository
tutorial

Clone a Repository

You don’t always need to create a repository from scratch. Often, you’ll want to get an existing remote repository onto your local machine. This is called cloning.

What is Cloning?

Cloning creates a local copy of a remote repository, including all files, commits, and branches. It automatically sets up the remote as origin.

How to Clone

Navigate to the folder where you want the project to be placed, then run:
git clone https://github.com/username/repo.git
This creates a folder named repo (or you can specify a different name).

Example:
git clone https://github.com/octocat/Hello-World.git my-hello
This clones into a folder named my-hello.

What Does Cloning Give You?

After cloning:
  • You have a full copy of the repository with its entire history.
  • The remote origin is automatically configured.
  • Your local default branch (usually main) tracks the remote branch.
You can verify with:
git remote -v
git branch -a

Cloning vs. Downloading ZIP

You could download a ZIP of a repository, but you wouldn’t get the Git history, and you wouldn’t be able to pull updates or push changes. Always clone if you plan to contribute or stay updated.


Two Minute Drill
  • git clone creates a local copy of a remote repository.
  • It includes the entire history and automatically sets up the remote.
  • You can specify a folder name after the URL.
  • Cloning is better than downloading ZIP because you keep Git functionality.

Need more clarification?

Drop us an email at career@quipoinfotech.com