【发布时间】:2014-08-02 15:12:23
【问题描述】:
Git 新手问题。我有两个组织设置,并希望将存储库从一个组织复制/复制到另一个组织。 这样做的步骤是什么?
【问题讨论】:
-
这是一次性复制操作还是应该让两个存储库不断更新?
-
我真的认为第一步是read the docs一点。
标签: git repository code-duplication
Git 新手问题。我有两个组织设置,并希望将存储库从一个组织复制/复制到另一个组织。 这样做的步骤是什么?
【问题讨论】:
标签: git repository code-duplication
您只需通过git clone 克隆存储库。
git clone path/to/other/organizations/repository
【讨论】:
您可以通过git-copy 实现此目的。
git copy https://github.com/org1/repo.git https://github.com/org2/repo.git
【讨论】:
考虑testRepo 是某个组织或用户sampleOrg 下的repo 名称
所以你的 git url 将是 https://github.rackspace.com/sampleOrg/testRepo
步骤 1. 在其他组织下创建具有相同名称的 repo,您需要在其中复制。
eg: `https://github.rackspace.com/sampleOrgMirror/testRepo`
第 2 步。运行:git clone --bare https://github.com/sampleOrg/testRepo.git
第 3 步:运行:cd testRepo.git
第 4 步:运行:git push --mirror https://github.com/sampleOrgMirror/testRepo.git
第 5 步:运行:cd ..
第 6 步:运行:rm -rf old-repository.git
现在您的代码在https://github.com/sampleOrgMirror/testRepo.git 中可用
您可以点击链接了解更多详情 https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/duplicating-a-repository
【讨论】: