Skip to content

Instantly share code, notes, and snippets.

@acidtone
Last active September 27, 2021 05:03
Show Gist options
  • Save acidtone/118524514ed48670440ed5213c60c602 to your computer and use it in GitHub Desktop.
Save acidtone/118524514ed48670440ed5213c60c602 to your computer and use it in GitHub Desktop.
Git Activity: Clone a GitHub repository to your local machine

Git Activity: Clone a GitHub repository to your local machine

Source: Cloning a repository in the GitHub Docs.

  1. Create a GitHub repository
  2. Clone a GitHub repository to your local machine.
  3. Add an empty webpage to a local repo
  4. Commit changes to index.html.
  5. push changes to GitHub.
  6. Deploy your GitHub repo to GitHub Pages.

Pre-requisites

Instructions

  1. On GitHub, navigate to the main page of the repository.

  2. Above the list of files, click "Code".

    "Code" button

  3. To clone the repository using HTTPS, under "Clone with HTTPS", click the copyboard icon. To clone the repository using an SSH key, including a certificate issued by your organization's SSH certificate authority, click Use SSH, then click the copyboard icon.

    The clipboard icon for copying the URL to clone a repository

    The clipboard icon for copying the URL to clone a repository with GitHub CLI

  4. Open Terminal.

  5. Change the current working directory to the location where you want the cloned directory.

  6. Type git clone, and then paste the URL you copied earlier.

    $ git clone https://github.com/YOUR-USERNAME/YOUR-REPOSITORY
    
  7. Press Enter to create your local clone.

    $ git clone https://github.com/YOUR-USERNAME/YOUR-REPOSITORY
    > Cloning into `Spoon-Knife`...
    > remote: Counting objects: 10, done.
    > remote: Compressing objects: 100% (8/8), done.
    > remove: Total 10 (delta 1), reused 10 (delta 1)
    > Unpacking objects: 100% (10/10), done.
    
  8. Navigate to your new cloned directory.

    $ cd YOUR-REPOSITORY
    

Next Step

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment