This quick article assumes that you have an AWS CodeCommit repository set up and have access to it. It also assumes you have access to the GitHub repository that you want to migrate.
The key technique here is that you are going to clone a “bare copy” of your GitHub repo into a temporary place in your computer. I like to do this in my Downloads folder on my mac.
Open up a terminal and
cd Downloads/ . Then, you will make a “bare copy” of your git hub repo like this:
git clone --mirror <git hub clone url> repository-migration
Note the name of the folder you are putting this “bare copy” into and
Now, we will push this copy into the new CodeCommit repo that you have already created and have access to.
git push <codecommit repo url> --all
This pushes everything except tags into the CodeCommit repo. To push tags you do this.
git push <codecommit repo url> --tags
Now, you can delete the temp repo in your downloads if you want.
Finally, you should delete your old GitHub repo if you wish and clone your new CodeCommit repo.