git clone
The command that copies an entire repository, every commit and branch, from a remote to a new folder on your machine.
In more detail
It creates the folder, copies the history, names the source remote origin, creates remote-tracking branches, and checks out the default branch with its upstream set. The result is a full, independent repository. Hooks and local config are not copied, because .git/hooks and .git/config are not part of the history.
Examples
git clone ../remote.git projectEvery clone is a complete copy of every secret ever committed, which is why the course counts clones when deciding whether rewriting history would even help.In Terraform: A freshly cloned Terraform repository has no downloaded plugins, modules or backend connection. That is why terraform init is always the first command after cloning.Related terms
- remote — A short name saved in a repository's config that stands for another repository's location, a URL or a path, so you can fetch from and push to it.
- origin remote — The default name git clone gives the remote you cloned from; a convention, not a special keyword.
- fork — A copy of someone else's repository made on a hosting service such as GitHub, under your own account, so you can push to it.
- upstream branch — The remote branch your local branch is linked to, which git push, git pull and git status use when you do not name one.
- repository — A project folder whose full history is tracked by version control; in Git, your files plus the hidden .git directory that stores every commit.
- commit history — The full chain of commits in a repository, which keeps every past version of every file, including deleted secrets.
- Git — A free, open-source distributed version control system that records the history of a project as a chain of snapshots.
- terraform init — The command that prepares a directory for Terraform: it downloads providers, fetches modules, connects the backend and writes the lock file.
Taught in
- Why Version Control, And Why Git Won — Advanced Git Internals & Distributed Workflows
- A Repository Is A Folder With A Memory — Advanced Git Internals & Distributed Workflows
- Conventional Commits — Advanced Git Internals & Distributed Workflows
- Ignoring Files, And The Tracked File Trap — Advanced Git Internals & Distributed Workflows
- What A Remote Actually Is — Advanced Git Internals & Distributed Workflows
- Clone, Forks, Push, And The Upstream Branch — Advanced Git Internals & Distributed Workflows
- Why Secrets Leak — Application Security & Threat Modeling for Engineers
- Secret Scanning — Application Security & Threat Modeling for Engineers
- Initialising The Working Directory — Infrastructure as Code with Terraform
- The Local Backend, And Workspaces On One Machine — HashiCorp Terraform Associate (004) Exam Prep