I've moved a Git repository (containing several submodules) to another directory on the local disk. Any git command produces the error:
fatal: Not a git repository: <absolute path to .git/modules/*>
The error is derived from absolute paths to files encoded in various places[1]. Two questions:
- Is there a Git command for fixing these paths, i.e., making them relative?[2]
- Is there a way to ensure that future Git repositories only use relative paths?[3]
Thanks!
Notes
I notice that with all submodules, the
.git
file contains:gitdir: <absolute path to repository>
The
core.worktree
parameter within each submodule (.git/modules/*/config
) is set to the absolute path of that submodule.I'm not looking for a shell command, rather a native Git method.
I'm not sure if absolute paths were created with an older version of Git, and newer that has since adopted relative paths.
sed -si
on your configs should fix it up until you can upgrade. – Calhoun