The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,860 other subscribers

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/Archivehttps://github.com/RichardBronosky/AWS_subnets for me.

Important Feature Notes

  1. 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.
  2. PRO: It retains [Wayback/Archive] gist commits from other authors
  3. CON: In spite of , it [Wayback/Archive] shows only 1 contributor (which is myself).
  4. CON: Even though [Wayback/Archive] my gist shows “[Wayback/Archive] forked from nboubakr/subnet.py“, this new/imported [Wayback/Archivegithub repo does [Wayback/Archivenot 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)”

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:

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!”

[Wayback/Archive] FQozu5HX0A0KKN5 (610×727)

[Wayback/Archive] FQpOgemXwAE52rj (616×725)

[Wayback/Archive] FQpORZAXEAMx1JO (459×140)

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.”

[Wayback/Archive] GDjl9hyWoAAZXuZ (445×201)

[Wayback/Archive] GDjmayPWcAAubnw (775×1012)

[Wayback/Archive] GDjmd7BWUAAel_t (775×937)

[Wayback/Archive] GDjmfrLWUAA5_fl (772×1073)

--jeroen

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.