Skip to content

Instantly share code, notes, and snippets.

@anilshrish
Created November 4, 2020 11:23
Show Gist options
  • Save anilshrish/f7d4373551363e7eb53eba412a971a73 to your computer and use it in GitHub Desktop.
Save anilshrish/f7d4373551363e7eb53eba412a971a73 to your computer and use it in GitHub Desktop.
git migrate repo | migrate git repo to AWS codecommit

Clone git repo

git clone --mirror https://github.com/miztiik/lex-faq-bot.git __tmp
cd  __tmp

Git push to repo1

git push https://github.com/anilshrish/lex-faq-bot1.git --all
git push https://github.com/anilshrish/lex-faq-bot1.git --tags

Git push to repo2

git push https://github.com/anilshrish/lex-faq-bot2.git --all
git push https://github.com/anilshrish/lex-faq-bot2.git --tags

Migrate git repository to aws codeCommit:

migration_dir="./_trash"
git_url="https://github.com/miztiik/lex-faq-bot.git"
aws_region="us-west-2"
codecommit_repo_name="lex-faq-bot"



# Initiate Migration
# Create CodeCommit Repo
aws codecommit create-repository \
  --repository-name ${codecommit_repo_name} \
  --repository-description "${codecommit_repo_name}" --profile default

# Clone Git to local (only for migration purposes; not for local development)
git clone --mirror ${git_url} ${migration_dir}

# Push the repo to CodeCommit
cd ${migration_dir}

git push https://git-codecommit.${aws_region}.amazonaws.com/v1/repos/${codecommit_repo_name} --all
git push https://git-codecommit.${aws_region}.amazonaws.com/v1/repos/${codecommit_repo_name} --tags

# CleanUp - Remove local copy
rm -rf ${migration_dir}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment