将git repo复制到另一个组织

时间:2014-08-02 15:12:24

标签: git repository code-duplication

Git新手问题。我有两个组织设置,并希望将存储库从一个组织复制/复制到另一个组织。 那会是什么步骤?

3 个答案:

答案 0 :(得分:1)

您只需通过git clone克隆存储库。

git clone path/to/other/organizations/repository

答案 1 :(得分:0)

您可以使用git-copy实现此目的。

git copy https://github.com/org1/repo.git https://github.com/org2/repo.git

答案 2 :(得分:0)

考虑 testRepo 是某个组织或用户 sampleOrg 下的存储库名称

所以你的 git url 将是 https://github.rackspace.com/sampleOrg/testRepo

第一步,在其他组织下创建同名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