Search code examples
gitdrupalgit-submodules

Git submodule fails to load due to outdated, invalid protocol


My company acquired a Drupal website with a complicated build process, using dozens of submodules. I'm using the following command to check out the repository and install submodules.

git clone --recursive  <.git URL copied from GitHub>

When the install process makes it to the microdata submodule, it fails every time:

Submodule 'tests/MicrodataPHP' (git://github.com/linclark/MicrodataPHP.git) registered for path 'src/sites/all/modules/contrib/microdata/tests/MicrodataPHP'
Cloning into '<local path>/src/sites/all/modules/contrib/microdata/tests/MicrodataPHP'...
fatal: unable to connect to github.com:
github.com[0: 140.82.113.3]: errno=Operation timed out

fatal: clone of 'git://github.com/linclark/MicrodataPHP.git' into submodule path '<local path>/src/sites/all/modules/contrib/microdata/tests/MicrodataPHP' failed

I've tried

  • Cloning the MicrodataPHP repo (it works just fine with HTTPS and GIT URLs)
  • Removing references to microdata from my project
  • Changing microdata URLs from HTTP to HTTPS
  • Downloading the Drupal microdata repo and adding to my project directly.
  • Downloading the MicrodataPHP repo and adding it directly to my project

Unfortunately nothing works. I need to make a single change to this repository to update the Google Analytics ID, but I can't build locally to confirm. And when I just push up a PR with that simple text change, my build fails in Travis with the same error, which means we can't get it to deploy. And I can't make the change directly in production because this site uses Docker Swarm.

Does anyone have suggestions on how to get around this issue? Alternately does anyone have a way to update this single line text change without requiring a rebuild of the entire site?


Solution

  • The submodule tests/MicrodataPHP uses URL with git:// protocol but the protocol was disabled at Github long ago. Use

    git config --global url.https://github.com.insteadOf git://github.com
    

    to make Git to always use https:// instead of git:// at GH. See the docs.