Anna Völkl
Anna Völkl

Reputation: 1664

Error on git submodule update --init

I have a main repository with several git submodules.

Lately I came about a new error which I cannot resolve:

fatal: Could not switch to '~/git': No such file or directory
Clone of '~/git/MyModule_A.git' into submodule path '.modman/MyModule_A' failed

What I'm doing

First, I clone the main repo as usual: git clone /path/to/the/bare/repo.git src

Then, I run git submodule update --init which does correctly register all submodules and they are added to the .git/config.

Submodule '.modman/MyModule_A' (~/git/MyModule_A.git) registered for path '.modman/MyModule_A'
Submodule '.modman/MyModule_B' (~/git/MyModule_B.git) registered for path '.modman/MyModule_B'
Submodule '.modman/MyModule_C' (~/git/MyModule_C.git) registered for path '.modman/MyModule_C'
fatal: Could not switch to '~/git': No such file or directory
Clone of '~/git/MyModule_A.git' into submodule path '.modman/MyModule_A' failed

What I have tried so far

Upvotes: 4

Views: 2504

Answers (1)

BartBog
BartBog

Reputation: 1979

The problem is the ~ in your submodule. Git does not know that this stands for /home/<yourusername>

If you replace it (in .gitmodules) by the absolute path, everything will work.

Upvotes: 5

Related Questions