This is normally the error made when there is no remote configured.
(From this thread)
It was a patch introduced to at least fixes the regression when running "git pull" in a repository initialized a long time ago that does not use the .git/config
file to specify where my remote repositories are.
a better message would probably be something like:
No default remote is configured for your current branch, and the default remote "origin" is not configured, either.
I think the message missed being made user-friendly in earlier passes due to being inaccessible at the time.
So this message indicates the remote repo mentioned in .git/modules is not declared in .git/config
From git submodule
Submodules are not to be confused with remotes, which are meant mainly for branches of the same project;
submodules are meant for different projects you would like to make part of your source tree, while the history of the two projects still stays completely independent, and you cannot modify the contents of the submodule from within the main project.
I believe you may have missed the step of git submodule init
:
submodule init
Initialize the submodules, i.e. register each submodule name and url found in .gitmodules into .git/config.
The key used in .git/config
is submodule.$name.url
.
This command does not alter existing information in .git/config.
You can then customize the submodule clone URLs in .git/config
for your local setup and proceed to git submodule update
; you can also just use git submodule update --init
without the explicit init step if you do not intend to customize any submodule locations.
If your remote repo (declared in .git/modules) is adequately referenced in .git/config, you should not have this error message anymore.
Before using (pullin) submodules, the steps:
git submodule init
git submodule update
remain necessary.
Note: Git 2.42 (Q3 2023) rewrites the description of giving a custom command to the submodule.<name>.update
configuration variable.
See commit 7cebc5b (25 Jul 2023) by Petar Vutov (pvutov
).
(Merged by Junio C Hamano -- gitster
-- in commit a53e8a6, 04 Aug 2023)
doc
: highlight that .gitmodules
does not support !command
Signed-off-by: Petar Vutov
Bugfix for fc01a5d ("submodule update documentation: don't repeat ourselves", 2016-12-27, Git v2.12.0-rc2 -- merge).
The custom command
and none
options are described as sharing the same limitations, but one is allowed in .gitmodules
and the other is not.
Rewrite the description for custom commands to be more precise, and make it easier for readers to notice that custom commands cannot be used in the .gitmodules
file.
git submodule
now includes in its man page:
It will also copy the value of submodule.$name.update
, if present in
the .gitmodules
file, to .git/config
, but (1) this command does not
alter existing information in .git/config
, and (2) submodule.$name.update
that is set to a custom command is not copied for security reasons.
You can then customize the submodule clone URLs in .git/config