Skip to content

Instantly share code, notes, and snippets.

@richardh-vccp
Created April 20, 2015 09:01
Show Gist options
  • Save richardh-vccp/e0e70b6078d2fb75df6a to your computer and use it in GitHub Desktop.
Save richardh-vccp/e0e70b6078d2fb75df6a to your computer and use it in GitHub Desktop.
GitHub to GitLab Backup
#!/bin/sh
token=ENTERYOURTOKEN
namespace_name=ENTERNAMESPACENAME
namespace_id=ENTERNAMESPACEID
repo=$1
git clone --mirror git@github.com:vccp/$repo.git &&
cd $repo.git &&
git remote set-url origin git@gitlab.vccphub.com:$namespace_name/$repo.git &&
curl --header "PRIVATE-TOKEN: $token" --data "name=$repo" --data "namespace_id=$namespace_id" http://gitlab.vccphub.com/api/v3/projects &&
git push origin &&
cd .. &&
rm -rf $repo.git
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment