I have a git repo for which someone has already added the submodule and it seems they have made this submodule as git url rather than https url so as of now the submodule update tries to clone it ssh based git url.
I am trying to change now this submodule clone type to https based url and have modified the .gitmodules file where I have put the correct https url however the cloning or updating the submodule using command git submodule update --init --recursive still uses the ssh based url. Upon further examination it is observed that config file in .git folder of the main repo still has ssh url and I am not sure what process I should follow further to update locally as well as push the change to main repo for everyone else.
>Solution :
After initial git clone --recursive or git submodule update --init --recursive URLs from .gitmodules copied to .git/config and changes in .gitmodules don’t affect .git/config. You need to update URLs in .git/config using this command:
git submodule sync --recursive
See the docs.
If you want to fix just one URL it could as simple as
cd <submodule_path>
git config submodule.<submodule_name>.url <new_URL>
cd <../back/to/the/superproject>
<submodule_path>, <submodule_name>, <new_URL>, <../back/to/the/superproject> are placeholders here.