Version Control
Git: Getting started
Git: Getting started
  • Introduction
    • What is version control
      • Distributed VCS
      • Summary
    • What is Git?
      • A Short History of Git
      • Under the hood
      • The Three States
    • What is GitHub?
  • Setting up Git
    • Installation
    • First time setup
    • Creating a repo
  • Basic operations
    • Recording Changes
      • Add another file
      • Modify-stage-commit
      • Modify-direct commit
      • View log
    • Undo changes
      • Restore (modified)
      • Restore (staged)
      • Amend (rare)
    • Clone repos
  • Remote Repos
    • Configure remote
    • Push to remote
      • Push branches
  • Reference
    • My Git Tutorials
    • Git Official
    • Others
Powered by GitBook
On this page
  1. Basic operations

Clone repos

Clone other repos

Here are the step-by-step instructions on how to clone an existing GitHub repository onto a local machine:

  1. Open up a terminal or command prompt on your local machine.

  2. Navigate to the directory where you want to clone the repository. You can use the cd command to change directories. For example: cd ~/Documents.

  3. Go to the GitHub repository page you want to clone and copy the repository URL from the "Code" button dropdown.

  4. In your terminal or command prompt, enter the following command:

    git clone <repository_url>

    Replace <repository_url> with the URL you just copied. For example:

    git clone https://github.com/exampleuser/example-repository.git
  5. Press enter to execute the command. Git will start cloning the repository into the directory you specified.

  6. Once the cloning is complete, you can navigate into the cloned repository directory using the cd command. For example: cd example-repository.

And that's it! You have successfully cloned a GitHub repository onto your local machine.

PreviousAmend (rare)NextConfigure remote

Last updated 2 years ago