克隆和复制git repo有什么区别? [英] What's the difference between cloning and copying a git repo?

查看:839
本文介绍了克隆和复制git repo有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

同样的问题存在于mercurial ,我想知道这如何适用于git?特别是,我感兴趣的情况下,有两个本地回购,并在服务器之间使用rsync等进行复制。

The same question exists for mercurial, and I'm wondering how this applies to git? In particular, I'm interested in cases where there are two local repos, and copying between servers using rsync or such.

此外,如果原来的repo本身克隆,说gitorious,我复制它,然后gitorious仍将存在作为一个远程(由主分支跟踪)在副本,对吧?

Also, if the original repo is itself cloned from, say gitorious, and I copy it, then gitorious will still exist as a remote (tracked by the master branch) in the copy, right? Does this happen if the copy is cloned instead?

推荐答案

克隆存储库会为您提供该存储库的副本将原始存储库配置为远程。

Cloning a repository gives you a copy of that repository and configures the original repository as a remote.

复制存储库只是为您提供了该存储库的副本。 (虽然你当然可以通过 git remote add 添加远程定义。)

Copying a repository just gives you a copy of that repository. (Though you can of course just add the remote definition afterwards via git remote add.)

复制存储库会复制其 .git / config 文件,以及其远程数据库。克隆存储库不会复制配置文件,因此不会共享远程数据库。 (克隆的存储库设置为生成的克隆中的 origin 远程)。

Copying a repository copies its .git/config file, and thus its remotes. Cloning a repository does not copy the config file, and thus the remotes are not shared. (The repository that was cloned from is set as the origin remote in the resulting clone.)

这篇关于克隆和复制git repo有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆