4

May be its simple question but I am not able to find right document to implement this. I have two aws account i.e personal P and Office O. For experiment purpose initially I have created Codecommit and attached 8 GIT projects. There are four users using P aws user credetntials and accessing it from last 6 months. There three branches and more than 100 commits. Now I want to move all these projects to Official account O without losing history of commit and its branches . I can safely take the master branch and create new repo ,but I need all history and branches. Can some one help me out ?

ULLAS K
  • 881
  • 2
  • 11
  • 24

3 Answers3

7

Would suggest looking at GitHub, they recommend using --mirror function "Duplicating a repository". My understanding is that this also work on AWS CodeCommit.

It uses:

  • git clone --mirror: to clone every references (commits, tags, branches)
  • git push --mirror: to push everything

That would give:

git clone --mirror https://codecommit-url/exampleuser/repository-to-mirror.git
# Make a bare mirrored clone of the repository

cd repository-to-mirror.git
git remote set-url --push origin https://codecommit-url/exampleuser/mirrored
# Set the push location to your mirror

git push --mirror
jarnohenneman
  • 963
  • 10
  • 21
1

Assuming you wish to continue using Codecommit. Then you have the ability to migrate all aspects of the codebase using the git --mirror command. Here is a link which relates to want you want to do

https://aws.amazon.com/blogs/devops/replicating-and-automating-sync-ups-for-a-repository-with-aws-codecommit/

Bear in mind that access credentials to the new repo will need new credentials generated by the IAM service.

Good luck

hynespm
  • 641
  • 4
  • 17
1

Basically, your goal is to clone the full repository using 'mirror' option, and push that repository to your CodeCommit repository in another account. These instructions assume you want to keep the same repository name for both accounts P and O. (And it's assuming your repo name is MyDemoRepo).

  1. git clone https://git-codecommit.us-east-1.amazonaws.com/v1/repos/MyDemoRepo --mirror
  2. Configure credentials for CodeCommit account O (this may mean updating/invalidating your existing OS credential cache)
  3. cd MyDemoRepo
  4. git push --mirror
David Jackson
  • 591
  • 2
  • 5