Certainly everyone has run into countless projects featured a source code repo that you wanted to clone (to build from source, for example). And certainly some of those repos were SVN-based. Now, if you're like me, you prefer the almighty git
to this archaic and decrepit format that coding dinosaurs eons ago once used. So, what do you do? Go to GitHub, search for <project name>
, and clone that. But wait, what if you run into a repo that doesn't have a GitHub mirror? What to do? Well, my friend, have you come to the right place:
I'm gonna go out on a limb and assume that you are UNIX-y, so if you am Windows, go here immediately to remedy that. Now then, fire up your terminal emulator, and follow along:
1.) Clone the repo with git
as follows: git svn clone <repo url> -T trunk -t tags -b branches <project name>
2.) Add a GitHub repo for the project ('cuz, you know, sharing and whatnot)
3.) cd <project name>
and git remote add origin git@github.com:<username>/<project name>.git
4.) Download the attached script update.sh
(and chmod +x update.sh
, naturally), and run ./update.sh <project name>
That's it! You've now got a historically-accurate translation of on GitHub! And, if you'd like, add the following to your cronjobs (crontab -e
):
* 3 * * * $HOME/git/mirrors/update.sh
This will call update.sh
without arguments. This will call the script on every repo within it's directory, so you can have more than one mirrored repo setup. Just repeat the above process for every additional repo!
Some side notes: