OpenGL icon indicating copy to clipboard operation
OpenGL copied to clipboard

fatal: protocol 'git clone --recursive https' is not supported

Open sunTFly opened this issue 1 year ago • 1 comments

1

sunTFly avatar Sep 11 '24 03:09 sunTFly

Quick fixes (pick the one that matches your situation)

  1. You meant to run git clone on the shell

Correct command (with submodules):

either

git clone --recursive https://github.com/owner/repo.git

or (preferred newer flag)

git clone --recurse-submodules https://github.com/owner/repo.git

If you accidentally typed the whole thing as one token (or included quotes badly), re-type exactly as above.

  1. The bad string is inside requirements.txt, package.json, or a similar manifest

Tools like pip, npm, go, etc., expect a URL or a package spec — not a shell command. Check your manifest for lines that contain git clone. Example mistakes:

WRONG in requirements.txt

git clone --recursive https://github.com/owner/repo.git

WRONG in package.json deps

"some-lib": "git clone --recursive https://github.com/owner/repo.git"

Fixes:

For pip/requirements, use:

git+https://github.com/owner/repo.git@#egg=packagename

and then:

pip install -r requirements.txt

For package.json (npm/yarn), use:

"some-lib": "git+https://github.com/owner/repo.git#commit"

For Go modules, don't put shell commands; use the module path (or replace in go.mod) and let go fetch it.

  1. In a Dockerfile / CI script the command is malformed

Check Dockerfile/CI script for something like:

RUN git "clone --recursive https://github.com/owner/repo.git"

or

RUN some_tool git clone --recursive https://github.com/owner/repo.git

Make sure git is invoked directly and flags are separate tokens:

RUN git clone --recurse-submodules https://github.com/owner/repo.git

  1. A wrapper / script passed a URL incorrectly to git or another program

Search your repo for the token git clone --recursive:

grep -R "git clone --recursive" -n .

If found in a script, make sure the script executes the git command rather than inserting it into a URL or an argument field.

Debug checklist (run these to narrow it down)

1) Confirm git works

which git git --version

2) See if any manifest contains the wrong string

grep -R "git clone --recursive" -n . grep -R "git clone" -n .

3) If using pip, check requirements

sed -n '1,200p' requirements.txt

4) If using package.json, inspect dependencies

cat package.json

Example: pip wrong -> correct

Wrong (causes your error):

git clone --recursive https://github.com/owner/repo.git

Right:

git+https://github.com/owner/repo.git@main#egg=repo_name

Jatkingmodern avatar Oct 11 '25 08:10 Jatkingmodern