Skip to content

Instantly share code, notes, and snippets.

@paulkearney
Created September 25, 2015 18:20
Show Gist options
  • Save paulkearney/6042561c56654a15af3c to your computer and use it in GitHub Desktop.
Save paulkearney/6042561c56654a15af3c to your computer and use it in GitHub Desktop.
Migrating from GitHub to AWS CodeCommit
while read r; do
echo $r
aws codecommit delete-repository --repository-name $r --region us-east-1
done < ~/dev/utility-scripts/aws/codecommit/repos.txt
while read r; do
echo $r
curl -X DELETE -u $GITHUB_USER:$GITHUB_PASSWD https://api.github.com/repos/$GITHUB_ORG/$r
done < ~/dev/utility-scripts/aws/codecommit/repos.txt
curl --silent -u $GITHUB_USER:$GITHUB_PASSWD https://api.github.com/orgs/$GITHUB_ORG/repos?per_page=100 -q | grep "\"name\"" | awk -F': "' '{print $2}' | sed -e 's/",//g' >> ~/dev/utility-scripts/aws/codecommit/repos.txt
cd ~/_trash
while read r; do
echo $r
aws codecommit create-repository --repository-name $r --region us-east-1
git clone --mirror [email protected]:$GITHUB_ORG/$r.git
cd $r.git
git push ssh://git-codecommit.us-east-1.amazonaws.com/v1/repos/$r --all
git push ssh://git-codecommit.us-east-1.amazonaws.com/v1/repos/$r --tags
sleep 10
aws codecommit update-default-branch --repository-name $r --default-branch-name master --region us-east-1
cd ..
done < ~/dev/utility-scripts/aws/codecommit/repos.txt
@igorparrabastias
Copy link

igorparrabastias commented Jul 20, 2017

It works smoothless, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment