我有两个存储库,我需要将整个存储库复制到另一个空的存储库,该存储库的访问级别与第一个存储库不同。副本和母存储库不应链接在一起。
我是 git 的新手,如果有人能帮助我,那就太棒了。
最佳答案
参见 https://help.github.com/articles/duplicating-a-repository
简短版:
为了进行精确复制,您需要同时执行裸克隆和镜像推送:
mkdir foo; cd foo
# move to a scratch dir
git clone --bare https://github.com/exampleuser/old-repository.git
# Make a bare clone of the repository
cd old-repository.git
git push --mirror https://github.com/exampleuser/new-repository.git
# Mirror-push to the new repository
cd ..
rm -rf old-repository.git
# Remove our temporary local repository
注意:以上内容适用于任何远程 git 仓库,说明并不特定于 github
上面创建了一个新的 repo 远程副本。然后将其克隆到您的工作机器上。
关于git - 如何复制一个 git 仓库? (没有 fork ),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6613166/