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 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"]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.
- Open the gist on
gist.github.com. - Select the Embed dropdown menu.
- Click Clone via HTTPS or Clone via SSH to copy the clone URL.
- In your terminal, run a normal
git clonewith that URL, then commit and push as needed.
Example shape (URL comes from the Embed menu):
git clone https://gist.github.com/.gitcd # edit, commit, push with your usual git workflowViewing gist commit history
- Open the gist.
- Click the Revisions tab at the top.
- 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.