This error occurs when attempting to deepen a shallow clone with git fetch --deepen on a Git server that lacks protocol support for the deepen capability. The deepen feature requires Git protocol version 2 support on the remote server.
This error indicates that the remote Git server does not support the "deepen" capability in the Git protocol. The --deepen option allows you to incrementally add more history to a shallow clone by specifying how many additional commits to fetch from the current shallow boundary, rather than from the branch tip. The deepen capability was introduced in Git protocol version 2 and requires server-side support. Older Git server versions (pre-2.19), certain Git hosting providers with legacy infrastructure, or servers that have disabled protocol v2 will reject fetch requests with the --deepen flag. This is particularly common in CI/CD environments where shallow clones are used to speed up builds, and subsequent operations try to deepen the history to access older commits for operations like rebasing or viewing full diffs.
First, verify what Git version the remote server is running to confirm if it supports protocol v2:
# Check if the server advertises protocol v2
GIT_TRACE_PACKET=1 git ls-remote origin 2>&1 | grep "version 2"
# Or check server capabilities
git ls-remote --symref origin HEADIf you don't see protocol v2 advertised, the server doesn't support --deepen.
Replace --deepen with --depth to specify an absolute depth from the branch tip:
# Instead of this (which requires deepen support):
git fetch --deepen=100
# Use this (works with all Git servers):
git fetch --depth=200 # Adjust to total desired depthNote that --depth counts from the branch tip, so if your shallow clone has depth 100 and you want 100 more commits, use --depth=200.
If you need the complete history, convert the shallow clone to a full clone:
# Fetch all history and convert to full clone
git fetch --unshallow
# Verify the repository is no longer shallow
git rev-parse --is-shallow-repository # Should output "false"This fetches all remaining history and removes the shallow boundary entirely. This works with all Git server versions.
As an alternative to --deepen, fetch history back to a specific date:
# Fetch all commits since a specific date
git fetch --shallow-since="2024-01-01"
# Or fetch commits from the last 90 days
git fetch --shallow-since="90 days ago"This provides more predictable results than --deepen and works on servers with protocol v2 support.
If you're encountering this in CI/CD, modify your pipeline configuration to avoid shallow clones:
# GitHub Actions
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Full clone, no shallow boundary
# GitLab CI
variables:
GIT_DEPTH: 0 # Disable shallow clone
# CircleCI (in .circleci/config.yml)
checkout:
post:
- git fetch --unshallow || trueWhile this increases clone time, it prevents all shallow-clone-related issues.
Protocol Version Compatibility: Git protocol v2 (which added deepen support) was released in Git 2.18 (June 2018) and enabled by default in Git 2.19 (September 2018). Check your server's Git version with git --version on the server. Some hosting providers may run newer Git versions but disable protocol v2 for compatibility or performance reasons.
Iterative Deepening Strategy: If --deepen is unavailable and you need to incrementally add history without fetching everything, you can implement your own iterative deepening by checking the date of your oldest commit and using git fetch --depth=N with progressively larger values until you have sufficient history. This is less efficient than --deepen but works universally.
Partial Clone Alternative: For very large repositories, consider using partial clone instead of shallow clone: git clone --filter=blob:none <url>. This fetches all commits but delays downloading blobs until needed. Partial clones support all Git operations (unlike shallow clones) and work with all protocol versions.
Server-Side Configuration: If you control the Git server and want to enable deepen support, ensure Git 2.19+ is installed and protocol v2 is enabled. Add protocol.version=2 to the server's Git config or set the GIT_PROTOCOL environment variable on the server.
kex_exchange_identification: Connection closed by remote host
Connection closed by remote host when connecting to Git server
fatal: unable to access: Proxy auto-configuration failed
How to fix 'Proxy auto-configuration failed' in Git
fatal: unable to access: Authentication failed (proxy requires basic auth)
How to fix 'Authentication failed (proxy requires basic auth)' in Git
fatal: unable to access: no_proxy configuration not working
How to fix 'no_proxy configuration not working' in Git
fatal: unable to read tree object in treeless clone
How to fix 'unable to read tree object in treeless clone' in Git