Skip to content

Instantly share code, notes, and snippets.

@gilbarbara
Last active October 18, 2022 23:45
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save gilbarbara/f644cc76f70127d216b5 to your computer and use it in GitHub Desktop.
Save gilbarbara/f644cc76f70127d216b5 to your computer and use it in GitHub Desktop.
Install git submodules from a .gitmodules file
#!/bin/sh
set -e
git config -f .gitmodules --get-regexp '^submodule\..*\.path$' |
while read path_key path
do
url_key=$(echo $path_key | sed 's/\.path/.url/')
url=$(git config -f .gitmodules --get "$url_key")
git submodule add $url $path
done
@AhmedBHameed
Copy link

Thank you for the nice script. But why git dose not respect .gitmodules file which already created when you add a new repo. ??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment