Enze Chi
Enze Chi

Reputation: 1753

How to use "--path" in git config?

It looks like Git can't resolve the ~/ path for submodule.

I tried to put ~/foo/myproject.git in .gitmodules as the submodule URL path, but when I try

$ git submodule init

I get an error saying Git can't find the repository.

If I change it to a path like /home/userA/foo/myproject.git, everything works fine.

I checked the help from Git. It looks like the --path can do something.

I don't like using an absolute path because sometimes the full path is not under my control. Is there a way to use a resolved path?

Upvotes: 0

Views: 355

Answers (1)

CharlesB
CharlesB

Reputation: 90276

Use $HOME/foo/myproject.git, it works is better than ~. Tilde is just a shortcut, its expansion isn't always good.

Git submodule paths can be relative since a long time ago, so it's always better to tell gitconfig the relative path.

Upvotes: 1

Related Questions