Last active
July 8, 2020 04:24
-
-
Save azilber/a9d744e3e3ff01d6f99c167b191a552c to your computer and use it in GitHub Desktop.
Revisions
-
azilber revised this gist
Jul 8, 2020 . 1 changed file with 3 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -29,7 +29,8 @@ for g in $DIR; do if [ $? -gt 0 ]; then echo "Skipping $g. It's empty!" else git config credential.helper "!aws codecommit credential-helper --profile $PROFILE \$@" git config credential.UseHttpPath true URL=`aws codecommit create-repository --repository-name "$D-$g" --tags Terraform=false --repository-description "$DESC" --profile $PROFILE |jq -r '.[].cloneUrlHttp'` echo "Adding remote to $g" git remote add aws $URL @@ -41,4 +42,4 @@ for g in $DIR; do echo "Cleaned up" done echo "Completed: $DIR" -
azilber created this gist
Jul 8, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,44 @@ #!/bin/bash P=/home/git/repositories ls -altrh $P/ echo -n "Directory to migrate: " read D echo -n "Profile to migrate to: " read PROFILE workdir=/tmp DIR=$(ls $P/$D | sed 's/.git//g') for g in $DIR; do cd $workdir echo "Doing $D-$g" git clone file://$P/$D/$g.git echo "Cloned" DESC=`ls -altrh $P/$D/$g.git/ |tail -1 |cut -d\ -f6-20` echo "DESC: $DESC" echo "Clone url: $URL" cd $g git log -n 1 if [ $? -gt 0 ]; then echo "Skipping $g. It's empty!" else git config credential.help "!aws codecommit credential-helper --profile $PROFILE \$\@" URL=`aws codecommit create-repository --repository-name "$D-$g" --tags Terraform=false --repository-description "$DESC" --profile $PROFILE |jq -r '.[].cloneUrlHttp'` echo "Adding remote to $g" git remote add aws $URL git push aws master fi cd $workdir rm -Rf $g echo "Cleaned up" done echo "Completed $DIR"