Skip to content

@nicerobot /gist-backup.py forked from joneskoo/gist-backup.py
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Clone or update a user's gists locally
#!/usr/bin/env python
# Clone or update all a user's gists
# curl -ks https://raw.github.com/gist/1622504/gist-backup.py | python
# curl -ks https://raw.github.com/gist/1622504/gist-backup.py | USER=nicerobot python
import json
import urllib
from subprocess import call
from urllib import urlopen
import os
USER = os.environ['USER']
u = urlopen('https://gist.github.com/api/v1/json/gists/' + USER)
gists = json.load(u)['gists']
startd = os.getcwd()
for gist in gists:
gistd = gist['repo']
if os.path.isdir(gistd):
os.chdir(gistd)
call(['git', 'pull', 'git://gist.github.com/' + gistd + '.git'])
os.chdir(startd)
else:
call(['git', 'clone', 'git://gist.github.com/' + gistd + '.git'])
@fedir

I made a fork, which uses API v3 https://gist.github.com/fedir/5466075

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.