Git and SSH

Fork a project and clone it

Make your own copy of someone else's GitHub project and download it, ready to change.

Fill these in once
  1. Fork it and download your copy
    Terminal
    gh repo fork octocat/Spoon-Knife --clone

    Needs GitHub CLI, signed in. See “Install GitHub CLI and log in”. The original is added as “upstream” for you.

Check it worked

  1. Check where your copy points
    Terminal
    git remote -v

    origin is your fork. upstream is the original.

Undo it
  1. Delete your fork on GitHub
    Terminal
    gh repo delete

    Run it inside the folder and type the name to confirm. It deletes your copy only, never the original. GitHub may ask you to allow deleting first: gh auth refresh -s delete_repo

  1. Fork it and download your copy
    Terminal · Ubuntu / Debian
    gh repo fork octocat/Spoon-Knife --clone

    Needs GitHub CLI, signed in. See “Install GitHub CLI and log in”. The original is added as “upstream” for you.

Check it worked

  1. Check where your copy points
    Terminal · Ubuntu / Debian
    git remote -v

    origin is your fork. upstream is the original.

Undo it
  1. Delete your fork on GitHub
    Terminal · Ubuntu / Debian
    gh repo delete

    Run it inside the folder and type the name to confirm. It deletes your copy only, never the original. GitHub may ask you to allow deleting first: gh auth refresh -s delete_repo

  1. Fork it and download your copy
    PowerShell
    gh repo fork octocat/Spoon-Knife --clone

    Needs GitHub CLI, signed in. See “Install GitHub CLI and log in”. The original is added as “upstream” for you.

Check it worked

  1. Check where your copy points
    PowerShell
    git remote -v

    origin is your fork. upstream is the original.

Undo it
  1. Delete your fork on GitHub
    PowerShell
    gh repo delete

    Run it inside the folder and type the name to confirm. It deletes your copy only, never the original. GitHub may ask you to allow deleting first: gh auth refresh -s delete_repo

New to Fork? I explain it in plain English on Layman Terms.