制作本地git仓库的本地副本

时间:2015-01-26 20:03:39

标签: git dropbox

我在本地计算机上有一个git repo,我需要在本地100%重复。

问题在于我一直将我的本地回购保存在Dropbox中,它可以同步我的所有PC。今天Dropbox决定最终搞乱回购(这是关于时间)所以我很快断开我的网络并启动我的另一台PC - 这个回购很好!

显然,作为我没有经验的git用户 - 我没有推进很长一段时间,所以在这台其他机器上还有很多工作要做。我需要在dropbox之外复制这个repo,这样我就可以保存我的工作和分支,然后推送到一个安全的遥控器。

我尝试使用一些不同的参数进行git clone,但我只设法克隆了一个分支。我看了一下镜像命令,但无法弄明白。任何帮助!?

2 个答案:

答案 0 :(得分:0)

您可能需要git clone --mirror。来自git-clone man page

   --mirror
       Set up a mirror of the source repository. This implies --bare. Compared to --bare, --mirror not
       only maps local branches of the source to local branches of the target, it maps all refs
       (including remote-tracking branches, notes etc.) and sets up a refspec configuration such that
       all these refs are overwritten by a git remote update in the target repository.

复制目录也可以;但是,您必须确保您的副本还包含隐藏文件和文件夹。 (即:代替cd my-git-repo; cp * ../my-clone,调用cp -R my-git-repo my-clone)。这也将复制您的工作树,这对于简单备份很好,但如果您打算从此副本克隆,则不可取。

答案 1 :(得分:0)

如用户SLaks所述:“只需复制整个目录。”

相关问题