miztiik / migrate-from-github-to-codecommit

Migrate from Github to CodeCommit

Home Page:https://www.udemy.com/course/aws-cloud-development-kit-from-beginner-to-professional/?referralCode=E15D7FB64E417C547579&couponCode=AWS_4U_MAY

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Migrate from Github to AWS CodeCommit

You can migrate any existing Git repository to a CodeCommit repository. This demo shows you how to migrate a project hosted on Git repository to CodeCommit.

Fig : Migrate from Github to AWS CodeCommit

Follow this article in Youtube

Prerequisites

  1. Setup CodeCommit Get help here

Migration Details

Update the below values to match your requirements

migration_dir="./_trash"
git_url="https://github.com/miztiik/lex-faq-bot.git"
aws_region="eu-central-1"
codecommit_repo_name="lex-faq-bot"

Initiate Migration

# Create CodeCommit Repo
aws codecommit create-repository \
  --repository-name ${codecommit_repo_name} \
  --repository-description "My shiny new chat bot"

# 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 ssh://git-codecommit.${aws_region}.amazonaws.com/v1/repos/${repo_name} --all
git push ssh://git-codecommit.${aws_region}.amazonaws.com/v1/repos/${repo_name} --tags

# CleanUp - Remove local copy
rm -rf ${migration_dir}

Support

Please open a GitHub issue.

Feedback

Please open a GitHub issue. I do encourage you to contribute your changes and send me pull request.

References

[1] - AWS Docs - Migrate a Git Repository