开发者

How to move a git repository from 1 hard drive to another

开发者 https://www.devze.com 2022-12-27 04:35 出处:网络
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?

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 开发者_Python百科that)?

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

Thank you.


There is no problem in reallocation a git repo ... just mv it.
Pay attention to surrounding jobs that could use it (maybe you gave git-daemon a path to it?). But the repository itself can safely be moved around.


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

  • move just one (big) file
  • clone it (from the bundle) in the destination: git clone /my/new/drive/myrepo.bundle repo2
  • leave the first repo untouched (just in case)

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号