Git Clone Basics — Origin and Custom Folder Name
In the previous blog, we learned the concept of Git repositories.
Now let’s see the first real command you’ll use every day in Git — git clone.
Cloning is how you bring a remote repository (like from GitHub) into your local system.
What Does git clone Do?
- Suppose you already have a repository on GitHub.
- A new developer on your team doesn’t have it locally.
- Instead of copying files manually, they can just run
git clonewith the repo URL.
👉 Git will create a complete local copy of the repository, including:
- Default branch checkout
- Remote branches as tracking branches
- A default remote called origin
Cloning a Repository
Go to GitHub, open your repo, and copy its URL.
For example:
git clone git@github.com:user/git-remote-demo-youtube.git
👉 This creates a folder with the same name as the repo (git-remote-demo-youtube) and copies all files and commits inside it.
Check with:
ls
You’ll see the repo folder created.
Checking the Remote
When you clone, Git automatically sets a remote called origin.
cd git-remote-demo-youtube
git remote -v
👉 Output:
origin git@github.com:user/git-remote-demo-youtube.git (fetch)
origin git@github.com:user/git-remote-demo-youtube.git (push)
✅ Without any extra setup, your local repo already knows where the remote is.
Clone Into a Custom Folder Name
By default, Git names the folder after the repository. But you can choose your own folder name.
git clone git@github.com:user/git-remote-demo-youtube.git my-folder
👉 This creates a folder called my-folder instead of the default repo name.
Check:
ls
You’ll see:
my-folder/
Inside this folder, the remote origin still points to the same GitHub repository.
Visual Representation
Summary
git clone <url>→ Brings a remote repo to your local system.- Default folder name = repository name.
- You can specify a custom folder name when cloning.
- Git automatically sets the remote as origin.
Keep Learning 🚀
👉 Subscribe to Learning Ocean – Subscribers get coupon codes for my courses, early access to blogs and courses, and even exclusive YouTube videos.
👉 My YouTube Channel – More videos, more fun, and lots of learning!
👉 📺 Watch this topic in video form
Stay curious, keep coding, and let’s make learning fun together! 🎉