Skip to content

Instantly share code, notes, and snippets.

@serkanh
Created March 25, 2021 22:19
Show Gist options
  • Save serkanh/05ff2585ba3329e2164ab856801d0e84 to your computer and use it in GitHub Desktop.
Save serkanh/05ff2585ba3329e2164ab856801d0e84 to your computer and use it in GitHub Desktop.
Upload to codecommit.
#/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