How to Clone a Local Git Repository into Another Folder
git clone doesn't need GitHub: it can copy a repository from another folder on your own computer. That gives you a fresh copy with only what's committed, which is the quickest way to check that a project works from scratch, the way someone else would get it. This guide clones a local repository with Git 2.56.1.
Syntax
git clone <path to repository> <new folder>
| Part | What it means |
|---|---|
<path to repository> | The folder of the repository to copy, such as notes or ../notes |
<new folder> | The name of the copy. It must not exist yet, or must be empty |
Git's clone documentation says it "Clones a repository into a newly created directory", and for the folder: "Cloning into an existing directory is only allowed if the directory is empty."
The Example
A small repository called notes holds one commit with a README.md. The guide clones it into a new folder, notes-copy, next to it.
Prerequisites
- Git. Run
git --versionto see which one you have; this guide uses Git 2.56.1.
Step 1: Clone the Repository
From the folder that holds notes:
git clone notes notes-copy
Cloning into 'notes-copy'...
done.

Git created notes-copy and copied the committed files and the whole history into it. Anything you never committed in notes stays behind. The command works unchanged in PowerShell.
Step 2: Look Inside the Copy
Go into the copy and check its history, its source and its state:
cd notes-copy
git log --oneline
git remote -v
git status
09c582a (HEAD -> main, origin/main, origin/HEAD) Add the notes
origin /Users/you/source/notes (fetch)
origin /Users/you/source/notes (push)
On branch main
Your branch is up to date with 'origin/main'.
nothing to commit, working tree clean

git logshows the same commit as the original.git remote -vshows that the copy'soriginis the original folder, sogit pullthere would fetch new commits fromnotes.git statusshows a clean copy of the last commit.
Common Mistakes
| Mistake | What happens | Do this instead |
|---|---|---|
| Cloning into a folder that already exists and has files | fatal: destination path 'notes-copy' already exists and is not an empty directory. | Pick a new name, or delete the old copy first |
Leaving out the new name, next to the original: git clone notes | fatal: destination path 'notes' already exists and is not an empty directory., because Git names the copy after the source | Always give a new name when cloning on the same computer |
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
destination path ... already exists and is not an empty directory | A folder with that name is already there | Choose another name |
| A file you expected is missing from the copy | It was never committed in the original | Commit it there, then clone again |
FAQ
Do I need --local?
No. The documentation says that when "the repository is specified as a local path (e.g., /path/to/repo), this is the default, and --local is essentially a no-op."
How do I get rid of the copy?
Delete its folder. The original isn't affected.
Conclusion
git clone notes notes-copy made an independent copy of the committed project, with origin pointing back at the original. Give the copy a new name, and remember that uncommitted files don't come along.
Additional Resources
- git clone — every option, including
--local. - git remote — the
originthe clone set up.
