Last active
September 1, 2022 22:26
-
-
Save nolram/ccd891d6b97f9df2e116bee5486a0c06 to your computer and use it in GitHub Desktop.
Script to clone all repositories from AWS CodeCommit on a specific AWS Account.
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
#/bin/bash | |
# Script to clone all repositories from AWS CodeCommit on a specific AWS Account. | |
# This script clone ssh repositories, but it can be changed to use https | |
# Requirements | |
# aws-cli - https://aws.amazon.com/pt/cli/ | |
# jq - https://stedolan.github.io/jq/ | |
# git | |
profile="" | |
region="us-east-1" | |
projects=$(aws --profile ${profile} --region ${region} --no-paginate codecommit list-repositories | jq -r '.repositories[] | { repositoryName} | join("")') | |
for project in $projects | |
do | |
echo "Cloning $project" | |
if ! git clone ssh://git-codecommit.${region}.amazonaws.com/v1/repos/${project} "${project}" 2>/dev/null && [ -d "${project}" ] ; then | |
echo "Clone failed because the folder ${project} exists" | |
else | |
echo "Clone success" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment