The "git remote get-url origin" can be used to fetch the location of the remote. How do I do the same for all the submodules?
How to list the URL for all Git submodules?
Asked Answered
Run the command for every submodule:
git submodule foreach --recursive git remote get-url origin
For a different approach which also illistrates how to get the URL of a single named submodule:
for submodule in $(git submodule | awk '{ print $2 }' | xargs)
do
git config --file=.gitmodules submodule.${submodule}.url
done
this works without git submodule update --init
git config --file .gitmodules --get-regexp '\.url$' | awk '{print $2}'
based on List submodules in a Git repository
© 2022 - 2024 — McMap. All rights reserved.