我怎样才能重命名与子模块的Git存储库? [英] How can I rename a git repository with submodules?

查看:69
本文介绍了我怎样才能重命名与子模块的Git存储库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在目录 projects / myRepo 中有一个包含子模块的git存储库,我想将目录重命名为 projects / my-repo



根据这个问题可以简单地用 mv 来完成。但是在一个有子模块的仓库中,git总是告诉我:

lockquote>

fatal:不是git仓库:projects / myRepo / .git / path / to / submodule```


即使对于 git status



子模块配置:

  [submodulepath / to / submodule] 
path = path / to / submodule
url = https://github.com/user/projectName.git

子模块的内部路径不会更新?!有没有办法告诉git更新这些子模块路径?

解决方案

由于韦斯顿的测试(在克隆的repo中的子模块的克隆,初始化和更新)在重命名包含所述子模块的目录时按预期工作,我怀疑子模块 .git myRepo 的文件。本身就在你原来的Git repo子模块中。 >'在第一个子模块中。

您还可以比较两个子模块的内容(第一个是您尝试重命名的内容,第二个是您克隆的回购库中的第二个)


I have a git repository with submodules in the directory projects/myRepo and I want to rename the directory to projects/my-repo.

According to this question it can simply be done with mv. But in a repo with submodules git keeps telling me

fatal: Not a git repository: projects/myRepo/.git/path/to/submodule```

even for git status.

Submodule config:

[submodule "path/to/submodule"]  
   path = path/to/submodule  
   url = https://github.com/user/projectName.git  

Somehow the 'internal path' for the submodule does not get updated?! Is there a way to tell git to update these submodule paths?

解决方案

Since Weston's test (clone, init and update of a submodule in a cloned repo) worked as expected when renaming the directory including said submodule, I suspect something must have been wrong in the submodule .git itself in your original Git repo submodule.

You could compare/look for any file referencing 'myRepo' in that first submodule.
you can also compare the content of the two submodules (the first one you tried to rename, and the second one included in the repo that you cloned)

这篇关于我怎样才能重命名与子模块的Git存储库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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