如何将git存储库从一个硬盘驱动器移动到另一个硬盘驱动器 [英] How to move a git repository from 1 hard drive to another

查看:130
本文介绍了如何将git存储库从一个硬盘驱动器移动到另一个硬盘驱动器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在1个硬盘中有一个git存储库.我想将其重新定位到其他硬盘驱动器上.最安全的方法是什么? 1. cp -r? 2.焦油球? 3. git clone(但是它的URI是什么)?

I have a git repository in 1 hard drive. And I would like to relocate that to a different hard drive. What is the safest way to do that? 1. cp -r? 2. tar ball?? 3. git clone (but what is the URI for that)?

我担心git存储库是否包含绝对路径,以使到新目录的"mv"会破坏git.

I was concern if git repository contains absolute path so that 'mv' to a new directory will break git.

谢谢.

推荐答案

更通用的解决方案是使用

The more general solution is to use git bundle in order to:

  • 仅移动一个(大)文件
  • (从捆绑软件中)将其克隆到目标位置:git clone /my/new/drive/myrepo.bundle repo2
  • 保留第一个存储库不变(以防万一)

在您的情况下这不是必需的,但是保存一个文件可以方便地进行所有操作.

That is not cessary in your scenario, but having one file saving everything can come in handy.

这篇关于如何将git存储库从一个硬盘驱动器移动到另一个硬盘驱动器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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