Actually, you can migrate your repository not only from GitHub but also from any git-based source control service such as GitLab, BitBucket, Beanstalk (don’t confuse it with AWS Elastic Beanstalk). In order to migrate repository from non git-based source control service (such as Subversion, TFS, Perforce) you will have to migrate to a git-based service first. Also you can choose to migrate the whole repository or just some of the branches.
In this article I'll show how to migrate one of GitHub's AWS Samples repositories to AWS CodeCommit.
Step 1. Create a new repository in AWS CodeCommit
You need to create an empty repository in AWS CodeCommit where you want to migrate a GitHub repository:
aws codecommit create-repository --repository-name MyMigratedRepo --repository-description "This is a repo that was migrated from GitHub"
Step 2. Clone a target repository from GitHub to your local machine
First you need to get a target repository’s url from GitHub:
Then run the following commands:
# navigate to a directory where you want to save a new repository
cd "{my-full-path-to-destination-folder}"
# clone a repository from GitHub to your local machine
git clone --mirror https://github.com/aws-samples/aws-glue-samples.git myMigrationRepo
Step 3. Push a cloned repository to AWS CodeCommit
First you need to get a destination repository’s url from AWS CodeCommit:
Then run the following commands
git push https://git-codecommit.{my-region}.amazonaws.com/v1/repos/MyMigratedRepo --all
Step 4. Enjoy the results
Voila! We have just migrated a repository from GitHub into AWS CodeCommit:
Top comments (0)