Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use same protocol for git submodules?

In a git repository R I have a submodule that I initialized with the following command:

git submodule add git@mygitserver...

Now a user just cloned R using https and get an error when running

git submodule init
git submodule update

because he doesn't have ssh (with public key uploaded on the server) access. So my question is, is it possible to create a submodule that will automatically uses the same protocol than the one used to clone the parent repository on the git submodule update command ?

like image 975
Manuel Selva Avatar asked Apr 12 '16 05:04

Manuel Selva


1 Answers

That user can set the config:

git config --global url.https://mygitserver/.insteadOf ssh://git@mygitserver/
# or possibly (to be tested)
git config --global url.https://mygitserver/.insteadOf git@mygitserver/

That way, https urls will always be used for mygitserver (main repo or submodules), instead of ssh ones.

like image 116
VonC Avatar answered Oct 21 '22 17:10

VonC