Skip to content

cargo build fails with parse error on my ~/.gitconfig #4777

@laughinghan

Description

@laughinghan

In a brand new repo that happens to have hyper as a dependency, I get:

$ cargo build
error: failed to load source for a dependency on `hyper`

Caused by:
  Unable to update registry https://github.com/rust-lang/crates.io-index

Caused by:
  [7/-1] failed to parse config file: Invalid configuration key (in /Users/han/.gitconfig:34, column 0)

I just git cloned this repo, so I know my .gitconfig does not have any parse errors, and the line in question does not define a configuration key: https://github.com/laughinghan/dotfiles/blob/cd846f8069fb10fb25df072da50ec6d9f25f98e7/.gitconfig#L34

Obviously this is a pretty crazy .gitconfig, but it's a valid one, why does cargo build care? Doesn't it just use the system's git? (If you're curious, that crazy alias in question, git sgrep, is like git grep but instead of only searching the repo you're in, it will also recurse into submodules.)

$ git --version
git version 2.10.1 (Apple Git-78)

$ cargo --version --verbose
cargo 0.22.0
release: 0.22.0

$ rustc --version --verbose
rustc 1.22.1
binary: rustc
commit-hash: unknown
commit-date: unknown
host: x86_64-apple-darwin
release: 1.22.1
LLVM version: 4.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-gitArea: anything dealing with git

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions