Cloning a Repository
Git clone.
Cloning means downloading a full copy of a repository from GitHub, with its entire history. It's how you start working on an existing project, or how you get your own project onto a new computer.

- Download a full copy
- With the whole history
- Start on any computer
git clone
We move to the projects folder, and type git clone, with the repository's address, and a folder name. Git creates the folder, and downloads everything into it. Inside, the log shows the full history. And the remote called origin is already set up for us.
cd .. git clone https://github.com/sam/my-site.git laptop-copy Cloning into 'laptop-copy'... done. cd laptop-copy git log --oneline -n 3 f63a17a (HEAD -> main, origin/main, origin/HEAD) Link to about page ef9c947 Add basic styles 6784119 Add about page git remote -v origin https://github.com/sam/my-site.git (fetch) origin https://github.com/sam/my-site.git (push)
Clone, not download
GitHub also has a download zip button. But that gives you just the files, with no history, and no connection to GitHub. Cloning gives you a real repository, connected to origin, ready to pull and push. Without a folder name, clone simply uses the repository's name.
Summary
Git clone downloads a full repository, with history, and sets up origin for you. Next, keeping it up to date.
Key takeaways- git clone <url>
- Full history
- origin already set