如何复制git存储库? (不分叉) [英] How to duplicate a git repository? (without forking)
问题描述
我有两个存储库,我需要将整个存储库复制到另一个空的存储库,这个存储级别与第一个不同。副本和母库不应该链接在一起。
我是git的新手,如果有人可以帮我解决这个问题,那就太棒了。 b $ b
请参阅 https:// help .github.com / articles / duplicating-a-repository
短版:
为了制作完全相同的副本,您需要同时执行裸副本和镜像推送:
mkdir foo; cd foo
#移动到临时目录
git clone --bare https://github.com/exampleuser/old-repository.git
#存储库
cd old-repository.git
git push --mirror https://github.com/exampleuser/new-repository.git
#镜像推送到新存储库
cd ..
rm -rf old-repository.git
#删除我们的临时本地存储库
注意:上面的任何远程git repo都可以正常工作,说明并非特定于github
上面创建了一个新的回购远程副本。然后将其克隆到您的工作机器中。
I have two repositories, and I need to copy whole of one onto the other empty one which has different access levels from the first one. The copy and the mother repository should not be linked together.
I am new to git and it would be awesome if someone could help me with this.
See https://help.github.com/articles/duplicating-a-repository
Short version:
In order to make an exact duplicate, you need to perform both a bare-clone and a mirror-push:
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
NOTE: the above will work fine with any remote git repo, the instructions are not specific to github
The above creates a new remote copy of the repo. Then clone it down to your working machine.
这篇关于如何复制git存储库? (不分叉)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!