1

I've been searching around and discovered several topics about this that use a lot of various technologies like ruby and some bash scripts - but basically, I have a normal, plain github account and I want to "clean" it. But there is code on there I may want to keep, so I don't want to just destroy it all. Furthermore, there are almost 200 repos.

So I want to just clone them all to my hard drive, then back them up to a dummy account like bitbucket. I'm having a tough time with this though.

Is there a simple way to accomplish this? I'm using Windows 8, and my experience with command line tools is extremely minimal right now.

Ciel
  • 4,290
  • 8
  • 51
  • 110

2 Answers2

2

This is a solution involving command line tools. If this doesn't meet your immediate needs, maybe someone else will find it helpful.

First, here's a script that will produce a list (on stdout) of all your GitHub repositories:

You can authenticate using either a username and password or a personal API token. You can take the output of this command and feed it to a simple shell loop to clone all the repositories:

./repolist.py -t my_access_token |
while read url; do
  git clone $url
done

Go grab a coffee (or something more substantial, if you have a lot of data to clone), and when you come back you should have a local copy of everything.

larsks
  • 277,717
  • 41
  • 399
  • 399
  • I didn't want to get Python, but I had no choice. This did not disappoint, either. This has made me interested in python as a language, and it solved my problem. Thanks! – Ciel Feb 19 '15 at 16:12
0

You could use a tool like GitHub Archive which allows you to clone/pull public and private personal repos, organization repos, and gists all with one simple tool.

As for automation, you could then set up GitHub Archive to run once a day or once a week for example and it will skip those that are cloned and pull in new changes since the last time it was run of all others.

GitHub Project: https://github.com/Justintime50/github-archive

Justin Hammond
  • 595
  • 8
  • 20