Back to Resources

How to fork and clone GitHub gists

Fork a public gist with gh api POST /gists/{id}/forks, clone source and fork with gh gist clone, prove git remotes and REST JSON, then delete the fork.

What this covers

GitHub’s gist UI exposes fork, clone, and history for every gist. This how-to follows Forking and cloning gists, covering the UI and git clone flow described in GitHub docs.

Flowchart
5 linescompact
flowchart TD
    Gist["View Gist on gist.github.com"] --> Fork["Click 'Fork' -> Creates personal copy under your account"]
    Gist --> Clone["Copy HTTPS/SSH Clone URL"]
    Clone --> Local["Run git clone  locally"]
    Local --> Edit["Edit, commit, and push back to gist remote"]
Rendered from Mermaid source with the native ZeroLabs diagram container.

Forking gists

Gists are Git repositories, so you can fork any gist even if you are not the original author. GitHub does not spell out a separate numbered fork recipe on this page beyond that fact.

Each gist indicates which forks have activity, which makes it easier to find interesting changes from others.

Cloning gists

If you want local edits and then push them back, clone the gist and commit as you would with any Git repository. See also Cloning a repository.

  1. Open the gist on gist.github.com.
  2. Select the Embed dropdown menu.
  3. Click Clone via HTTPS or Clone via SSH to copy the clone URL.
  4. In your terminal, run a normal git clone with that URL, then commit and push as needed.

Example shape (URL comes from the Embed menu):

Terminalbash
git clone https://gist.github.com/.gitcd # edit, commit, push with your usual git workflow

Viewing gist commit history

  1. Open the gist.
  2. Click the Revisions tab at the top.
  3. Review the full commit history with diffs.

Practical notes

  • Clone via the Embed menu URLs, then use ordinary git commit/push locally.
  • Prefer HTTPS or SSH based on how you already authenticate to GitHub.
  • Use Revisions for history; starring and comment moderation are separate how-tos.
Share