4

可能是它的简单问题,但我无法找到正确的文件来实现这一点。我有两个 aws 帐户,即个人 P 和 Office O。出于实验目的,我最初创建了 Codecommit 并附加了 8 个 GIT 项目。有四个用户使用 Paws 用户凭证并在过去 6 个月内访问它。有 3 个分支和 100 多个提交。现在我想将所有这些项目转移到公众号 O 而不丢失提交历史及其分支。我可以安全地使用 master 分支并创建新的 repo,但我需要所有历史记录和分支。有人可以帮我吗 ?

4

3 回答 3

6

建议查看 GitHub,他们建议使用 --mirror function "Duplicating a repository"。我的理解是这也适用于 AWS CodeCommit。

它用:

  • git clone --mirror:克隆每个引用(提交、标签、分支)
  • git push --mirror:推送所有内容

那将给出:

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
于 2017-10-30T07:14:59.130 回答
1

假设您希望继续使用 Codecommit。然后,您可以使用 git --mirror 命令迁移代码库的所有方面。这是一个与您想要做的事情相关的链接

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

请记住,对新存储库的访问凭证将需要 IAM 服务生成的新凭证。

祝你好运

于 2017-10-30T07:48:34.347 回答
1

基本上,您的目标是使用“镜像”选项克隆完整存储库,然后将该存储库推送到另一个帐户中的 CodeCommit 存储库。这些说明假设您希望为帐户 P 和 O 保留相同的存储库名称。(并且假设您的存储库名称是 MyDemoRepo)。

  1. git clone https://git-codecommit.us-east-1.amazonaws.com/v1/repos/MyDemoRepo --mirror
  2. 为 CodeCommit 账户 O 配置凭证(这可能意味着更新/使您现有的操作系​​统凭证缓存无效)
  3. cd MyDemoRepo
  4. git push --镜像
于 2017-10-31T00:08:13.070 回答