Fork Gist to Repo on GitHub – Stack Overflow
Posted by jpluimers on 2024/01/09
It is not a full fork and misses a few things (including the Gist description), but is the easiest way to clone a gist to a regular GitHub repository.
I needed it because somehow pushing to gists was denied without explanation or real GitHub feedback.
Another reason is that regular GitHub repositories show you way more information about the commits than Gists do.
Thanks [Wayback/Archive] Noitidart for asking and [Wayback/Archive] Bruno Bronosky for answering at [Wayback/Archive] Fork Gist to Repo on GitHub – Stack Overflow:
Yes, directly!
Go to [Archive] https://github.com/new/import and put in the URL of your gist and a name for your new repo.
I just put in [Wayback/Archive] https://gist.github.com/RichardBronosky/1aed6606b1283277e7ff9eaa18097e78 and AWS_subnets and it created [Wayback/Archive] https://github.com/RichardBronosky/AWS_subnets for me.
Important Feature Notes
- PRO: It keeps all previous commit history including commit messages
- Many people don’t realize that gist commits may have commit messages that you cannot see with the web interface. The gist above has 2 [Wayback/Archive] very decrsiptive commit messages that I commited on my local clone and pushed out. They are hidden from the gist web interface, but show up in clones and also new repos created using this import feature.
- PRO: It retains [Wayback/Archive] gist commits from other authors
- CON: In spite of #2, it [Wayback/Archive] shows only 1 contributor (which is myself).
- CON: Even though [Wayback/Archive] my gist shows “[Wayback/Archive] forked from nboubakr/subnet.py“, this new/imported [Wayback/Archive] github repo does [Wayback/Archive] not show that it is a fork of anything (not nboubakr’s gist nor my gist)
Verdict
This works very well and I really appreciate the PROs. The cons are not enough to make me think that some other method would be better.
I will use this extensively in the future because I often create a gist that answers some Stack Overflow question. Then I expand upon it and realize it should be a full repo. Not that I think my work is of great significance, but because I think my commit messages are worth sharing. And this is because I am lazy and tend to not want to create documentation that just repeats what i have already said in commit messages.
Via [Wayback/Archive] fork gist to github – Google Search.
My forking was needed because of [Wayback/Archive] Jeroen Wiert Pluimers on Twitter: “Need @github help: Personal Access Token fails on … with a “The requested URL returned error: 403″, but works fine on … Why is that? (I own both repositories)”
- fails for [Wayback/Archive] gist: Script to rename a virtual machine in ESXi 6:

- works for [Wayback/Archive] jpluimers/vm-rename: Script to rename a virtual machine in ESXi 6; fork from https://gist.github.com/jpluimers/fcc601dd41ac89f601a5174be92c841c:
Edit 20240111: not sure why the below tweet didn’t make it to the original post, but here it is. Thanks [Wayback/Archive] Julia (@julia@mathstodon.xyz) – Mathstodon for reminding me with [Wayback/Archive] Julia: “@wiert Misschien heeft je pers…” – Mathstodon
@wiert Misschien heeft je personal access token (zie https://github.com/settings/apps) geen “gist”-toestemming.
Note that by now there are two kinds of tokens:
- classic tokens: https://github.com/settings/tokens
- beta test of fine grained tokens: https://github.com/settings/personal-access-tokens which have a more clear naming of the “gist” permission, see new screenshots further below and documentation at [Wayback/Archive] Permissions required for fine-grained personal access tokens – GitHub Docs.
The problem was (and still is) the confusing name of the (now classic) Personal Access Token level “create gist”: that one is for all gist operations as you can see in [Wayback/Archive] Jeroen Wiert Pluimers on Twitter: “No help from @github, but I have figured it out. Screenshot 1 is what the token is allowed to do. The unchecked “gist=Create gists” is not just for creating gists, but also to any other write operation to gists. So I recreated the token with “gist=Create gists”: now it works!”
On the new fine grained personal access tokens I just tweeted [Wayback/Archive] Jeroen Wiert Pluimers @wiert@mastodon.social on X: “@github By now a beta is running of “fine grained personal access tokens” that on the one hand distinguish between “repository permissions” (only for repositories, see first three screenshots) and “account permissions” (last screenshot) which contains the better explained “gists” entry.”
--jeroen







Leave a comment