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?
            Asked
            
        
        
            Active
            
        
            Viewed 2,212 times
        
    3 Answers
6
            Run the command for every submodule:
git submodule foreach --recursive git remote get-url origin
 
    
    
        phd
        
- 82,685
- 13
- 120
- 165
1
            
            
        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
 
    
    
        milahu
        
- 2,447
- 1
- 18
- 25
1
            
            
        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
 
    
    
        sshow
        
- 8,820
- 4
- 51
- 82
