Created
March 25, 2021 22:19
-
-
Save serkanh/05ff2585ba3329e2164ab856801d0e84 to your computer and use it in GitHub Desktop.
Upload to codecommit.
This file contains 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 characters
#/usr/local/bin/bash | |
#set -x | |
git config --global credential.helper '!aws codecommit credential-helper $@' | |
git config --global credential.UseHttpPath true | |
declare -a folders | |
find_all_folders(){ | |
for dir in $(find * -maxdepth 0 -type d);do | |
folders+=($dir) | |
done | |
} | |
get_remote_origin(){ | |
for f in "${folders[@]}" | |
do | |
cd "${PWD}/$f" && \ | |
git config --get remote.origin.url && \ | |
cd - &> /dev/null | |
done | |
} | |
create_codecommit_repository(){ | |
for f in "${folders[@]}" | |
do | |
aws codecommit create-repository --repository-name $f 2> /dev/null | |
done | |
} | |
add_codecommit_repository(){ | |
for f in "${folders[@]}" | |
do | |
cd "${PWD}/$f" && \ | |
git remote rm codecommit | |
git remote add codecommit https://git-codecommit.us-east-1.amazonaws.com/v1/repos/${f} | |
cd - &> /dev/null | |
done | |
} | |
push_to_codecommit_repository(){ | |
for f in "${folders[@]}" | |
do | |
cd "${PWD}/$f" && \ | |
git push codecommit master | |
cd - &> /dev/null | |
done | |
} | |
find_all_folders | |
#get_remote_origin | |
#create_codecommit_repository | |
add_codecommit_repository | |
push_to_codecommit_repository |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment