How to Migrate AWS Code Commit repository to another AWS Code Commit Account

  • Sumo

This article is just to document my task for future reference. Below is the step-by-step instruction on how to migrate an AWS code commit repository to another AWS Code Commit. This need usually occur if you are transferring to a new AWS account and you want to terminate your old AWS account.

Here are the steps.

  1. Open a terminal or command prompt window
  2. Run a git clone command with mirror option by typing git clone –mirror url-of-your-old-repository local-mirror-folder . Example: git clone –mirror https://github.com/awslabs/aws-demo-php-simple-app.git aws-codecommit-demo
  3. Change directories to the directory where you made the clone. Example. cd aws-codecommit-demo
  4. Run the git push command, specifying the URL and name of the destination CodeCommit repository and the –all option.  Example git push https://git-codecommit.us-east-2.amazonaws.com/v1/repos/MyClonedRepository –all

You may now clone the new repository to your local machine for

Reference: https://docs.aws.amazon.com/codecommit/latest/userguide/how-to-migrate-repository-existing.html

Tagged ,

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.