How to fix fatal: Server does not support --shallow-exclude in Git

GitINTERMEDIATELOWUpdated Dec 2, 2025ยท 114 views

This error occurs when attempting to use git clone --shallow-exclude with a remote server that doesn't support this advanced shallow cloning feature. The server may be running an older Git version or have protocol limitations.

Quick fix

Fixes fatal: Server does not support --shallow-exclude

git clone --depth 1 https://github.com/user/repo.git
  1. Use --depth instead of --shallow-exclude
  2. Try --shallow-since as an alternative
  3. Switch from HTTPS to SSH protocol
  4. Verify you're using ref names, not commit hashes
git โ€” error
git clone --depth 1 https://github.com/user/repo.git
fatal: Server does not support --shallow-exclude

What this error means

The --shallow-exclude option allows you to create a shallow clone while excluding commits reachable from specific remote branches or tags. This is an advanced feature that requires the remote Git server to support the "deepen-not" capability through Git protocol v2. When you see this error, it means the remote repository's Git server either doesn't advertise the shallow-exclude capability, is running an older version of Git (pre-2.18), or is using a transport protocol (like dumb HTTP) that doesn't support advanced shallow features. This typically happens when cloning from older self-hosted Git servers, certain cloud providers with legacy Git infrastructure, or when using HTTPS with repositories that haven't enabled protocol v2 support.

Typical symptoms

  • Command fails immediately with "fatal: Server does not support --shallow-exclude"
  • Error occurs during git clone with --shallow-exclude flag
  • May also see "the remote end hung up unexpectedly" with some servers
  • Works with --depth but fails with --shallow-exclude on the same repository
  • SSH clones may succeed where HTTPS clones fail with this option

Common causes

  1. Remote Git server is running a version older than 2.18 (released June 2018)
  2. Server hasn't enabled Git protocol v2 support in its configuration
  3. Using dumb HTTP transport which doesn't support shallow capabilities
  4. Server-side Git installation lacks the "deepen-not" capability
  5. Attempting to use commit hashes instead of branch/tag names with --shallow-exclude
  6. Repository host (GitHub, GitLab, etc.) hasn't implemented this feature yet

How to fix "fatal: Server does not support --shallow-exclude"

1Use --depth instead of --shallow-exclude

The most straightforward workaround is to use the more widely supported --depth option for shallow cloning:

bash
git clone --depth 1 https://github.com/user/repo.git

This creates a shallow clone with only the most recent commit. Adjust the depth number as needed (e.g., --depth 50 for the last 50 commits).

2Try --shallow-since as an alternative

If you need to exclude older history, use --shallow-since instead, which is more widely supported:

bash
git clone --shallow-since="2024-01-01" https://github.com/user/repo.git

This clones commits only from the specified date forward, which can achieve similar results to --shallow-exclude.

3Switch from HTTPS to SSH protocol

Some servers support shallow-exclude over SSH but not HTTPS. Try cloning with SSH instead:

bash
git clone --shallow-exclude=old-branch git@github.com:user/repo.git

Make sure you have SSH keys configured for the remote server.

4Verify you're using ref names, not commit hashes

The --shallow-exclude option requires branch or tag names, not arbitrary commit SHAs:

bash
# Correct - using branch name
git clone --shallow-exclude=development https://github.com/user/repo.git

# Incorrect - using commit hash
git clone --shallow-exclude=abc123def https://github.com/user/repo.git

If you were using a commit hash, switch to the branch or tag name instead.

5Perform a full clone if shallow options aren't critical

If you don't strictly need a shallow clone, do a regular full clone:

bash
git clone https://github.com/user/repo.git

You can later convert to a shallow repository or clean up old history if disk space is a concern.

6Check server Git version and upgrade if possible

If you control the remote server, verify the Git version and upgrade if needed:

bash
# On the server
git --version

# Should be 2.18 or later for protocol v2 support

Ensure the server has protocol.version configured:

bash
git config --global protocol.version 2

Advanced notes

The --shallow-exclude feature was introduced as part of Git's protocol v2 capabilities, specifically the "deepen-not" command. This requires both client and server to be running Git 2.18 or later (released June 2018).

For self-hosted Git servers, enabling protocol v2 may require additional configuration beyond just upgrading Git. On GitLab, for example, you need to ensure the Git-Protocol HTTP header is properly propagated through workhorse to gitaly. For SSH, the sshd server must be configured to accept the GIT_PROTOCOL environment variable.

The --shallow-exclude option can be used multiple times to exclude several branches. Internally, it's equivalent to running "git rev-list --not <ref>" on the server side. Note that --shallow-exclude cannot be used together with --depth, but can be combined with --shallow-since.

If you're working with a repository that doesn't support --shallow-exclude, consider whether you actually need this specific feature. In many CI/CD scenarios, --depth 1 provides sufficient history reduction. For development workflows where you need selective history, a full clone followed by local branch management may be more reliable than relying on advanced shallow features that aren't universally supported.

Frequently asked questions

What does "fatal: Server does not support --shallow-exclude" mean?
The --shallow-exclude option allows you to create a shallow clone while excluding commits reachable from specific remote branches or tags. This is an advanced feature that requires the remote Git server to support the "deepen-not" capability through Git protocol v2. 18), or is using a transport protocol (like dumb HTTP) that doesn't support advanced shallow features.
How do I fix "fatal: Server does not support --shallow-exclude"?
This error occurs when attempting to use git clone --shallow-exclude with a remote server that doesn't support this advanced shallow cloning feature. The server may be running an older Git version or have protocol limitations.
What causes "fatal: Server does not support --shallow-exclude"?
Remote Git server is running a version older than 2.18 (released June 2018) Server hasn't enabled Git protocol v2 support in its configuration Using dumb HTTP transport which doesn't support shallow capabilities
Is the "fatal: Server does not support --shallow-exclude" error serious?
It is a low-severity error โ€” more of a blocker than a risk. The steps above resolve it.

Official resources & further reading