我有两个存储库,我需要将整个存储库复制到另一个存储库中,它与第一个存储库具有不同的访问级别.副本和母库不应链接在一起.
我是git的新手,如果有人可以帮助我,这将是非常棒的.
Lar*_*y K 179
请参阅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
Run Code Online (Sandbox Code Playgroud)
注意:以上内容适用于任何远程git repo,指令不是特定于github
上面创建了一个新的repo远程副本.然后将其克隆到您的工作机器.
Qua*_*ong 21
你也可以使用git-copy.
用Gem安装,
gem install git-copy
Run Code Online (Sandbox Code Playgroud)
然后
git copy https://github.com/exampleuser/old-repository.git \
https://github.com/exampleuser/new-repository.git
Run Code Online (Sandbox Code Playgroud)
Abi*_*hen 12
2021 年 11 月更新
现在您可以轻松地从 github 中的另一个 VC 复制文件和文件夹。
脚步:
导入成功完成后,您将收到电子邮件通知。
如果您只想使用现有存储库中的全部或大部分文件(即作为一种模板)创建一个新存储库,我发现最简单的方法是使用所需名称等创建一个新存储库,将其克隆到您的桌面,然后只需在其中添加您想要的文件和文件夹。
你没有得到所有的历史等,但在这种情况下你可能不想要。
| 归档时间: |
|
| 查看次数: |
92166 次 |
| 最近记录: |