Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pull All Gists from Github?

Tags:

git

github

gist

Is there an API call or any scripts that I failed to overturn that would pull all my Gists from Github to an outside git repo or just return me a list of their names? I know each one is a separate git repo, so I have assumed the best I can do is get the latter, then script to get all of them onto my local box.

EDIT 1: I know about pulling and pushing git repos from one service to another, I am specifically looking for people who have the 411 on collecting an authoritative list of all Gists I have, private and public. I also thought this might be useful to others. It is not so much about migration, but a backup strategy . . . of sorts.

EDIT 2: So, it appears this might not be possible. I apparently did not Google hard enough to search the updated Github/Gist API. The other API calls work with simple curl commands, but not the v1 API for Gist. Still, the API says TBD for all private and public Gists, so I think that puts the cabash on the whole thing unless an enlightened soul hooks a brotha up.

$ curl http://github.com/api/v2/json/repos/show/alharaka {"repositories":[{"url":"https://github.com/alharaka/babushka","has_wiki":true,"homepage":"http: ... # tons of more output echo $? 0 $  

This one does not work so hot.

$ curl https://gist.github.com/api/v1/:format/gists/:alharaka $ echo $? 0 $ 

EDIT 3: Before I get asked, I noticed there is a difference in the API versioning; this "brilliant hack" did not help either. Still very cool though.

$ curl https://gist.github.com/api/v2/:format/gists/:alharaka # Notice v2 instead of v1 $ echo $? 0 $ 
like image 798
songei2f Avatar asked Jul 10 '11 16:07

songei2f


People also ask

How do I find my gists on GitHub?

Once you have logged into your GitHub account, click on your username in the top right corner. This will open a menu where you can see an option called 'Your gists'. Once you clicked that option, you will see your gist page.

How do you clone a gist file?

With the URL in your clipboard, open the Gist Dev menu and select the Clone a Gist Repository item. You will then be presented with an input field where you can paste the URL copied from GitHub. Click the Clone button or press enter, and the repository will be cloned to your computer.

Can gists have multiple files?

Running code from gists​ scala-cli downloads the gist's archive and unzips it, so the gist can contain multiple files that depend on each other.


1 Answers

Version 3 of the GitHub API allows this in a pretty simple way:

https://api.github.com/users/koraktor/gists 

gives you a list of all Gists of the user and that list offers a various amount of URLs including the API URLs to the individual Gists like

https://api.github.com/gists/921286 

See the Gists API v3 documentation.

like image 51
Koraktor Avatar answered Sep 23 '22 05:09

Koraktor