Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When using git submodule update how can you tell it to clone the dependencies with HTTP instead of GIT?

Tags:

git

We have port 9418 blocked here so I can't seem to clone with git://xyz.git

Is there a way to make git use HTTP instead? If I do it manually it works but when I run git submodule update it always wants to use git:

like image 550
Webjedi Avatar asked May 04 '11 17:05

Webjedi


2 Answers

You need to change the configuration variable submodule.<submodule-name>.url for each submodule, e.g.:

git config submodule.whatever.url http://github.com/nvie/shFlags.git

Then when you do git submodule update, the git fetch which is run in that submodule will use the URL from that configuration variable.

If you want to change origin in that submodule, you'll need to take some separate steps:

cd whatever
git remote rm origin
git remote add origin http://github.com/nvie/shFlags.git

... but if you're not actively working in that submodule, you don't have to worry about that.

The .gitmodules file is just used to set the submodule.<submodule-name>.url variable when you initialize the submodule. It's not worth changing unless you want to push a new version of the .gitmodules file, and it's good policy to make sure that URLs in the .gitmodules file are accessible to everyone who might clone it (e.g. typically you wouldn't commit a .gitmodules file with SSH URLs.)

like image 162
Mark Longair Avatar answered Oct 01 '22 21:10

Mark Longair


This depends on how the submodules are registered. You must edit the file .gitmodules before git submodules init.

like image 45
KingCrunch Avatar answered Oct 01 '22 22:10

KingCrunch