Skip to content

Submodule of Git Dependency Hanging in Git CLI Mode #15775

@baxterjo

Description

@baxterjo

Problem

When adding a dependency with a git reference, if that dependency has a submodule in it, cargo will hang when trying to download the submodule. If the dependency is added as a bare crates.io style dependency then everything works fine.

This only happens with CARGO_NET_GIT_FETCH_WITH_CLI=true is applied.

I have ruled out my git config being the issue here by cloning the repository down and issuing the exact same command that cargo issues (found by running carbo build --verbose) and the command executed with no problems.

The git config is the issue see comment below

Normally I would just turn off CLI mode, but my company uses git dependencies with SSH addresses for private crates, so this is not an option.

Since this is a net operation I have included a PCAP with this issue that contains only traffic to / from github (140.82.116.4)
cargo_build_with_git_cli.pcapng.zip

Steps

Minimum Cargo.toml for repro:

[package]
name = "test-submodule-dep"
version = "0.1.0"
edition = "2024"

[dependencies]
rdkafka = { git = "https://github.com/fede1024/rust-rdkafka.git" } # This repository uses a submodule for its `*-sys` dependency.
  1. CARGO_NET_GIT_FETCH_WITH_CLI=true cargo build --verbose verbose is not required
  2. cargo will hang when trying to fetch the submodule

Possible Solution(s)

No response

Notes

I have tried messing with some of the unstable features concerning git and cargo. Although I think they all get overridden when using git in CLI mode.

Version

cargo 1.88.0 (873a06493 2025-05-10)
release: 1.88.0
commit-hash: 873a0649350c486caf67be772828a4f36bb4734c
commit-date: 2025-05-10
host: aarch64-apple-darwin
libgit2: 1.9.0 (sys:0.20.0 vendored)
libcurl: 8.7.1 (sys:0.4.80+curl-8.12.1 system ssl:(SecureTransport) LibreSSL/3.3.6)
ssl: OpenSSL 3.4.1 11 Feb 2025
os: Mac OS 15.5.0 [64-bit]

git version 2.50.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-gitArea: anything dealing with gitC-bugCategory: bugS-needs-infoStatus: Needs more info, such as a reproduction or more background for a feature request.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions