Skip to content

Private git dependency URLs with credentials do not resolve #1514

@meridionaljet

Description

@meridionaljet

Working with private git repos that require a username and token to resolve seems to fail in uv:

uv pip install '{packagename} @ git+https://{username}@github.com/{organization}/{packagename}.git'
Updating https://{username}/ (github.com/{organization}/{packagename}.git) 
error: Failed to download and build: {packagename} @ git+https://{username}@github.com/{organization}/{packagename}.git
  Caused by: Git operation failed
  Caused by: failed to fetch into: /home/user/.cache/uv/git-v0/db/20cbf189775078d1
  Caused by: failed to connect to the repository
  Caused by: failed to resolve address for {username}: Temporary failure in name resolution; class=Net (12)

pip will read ~/.git-credentials and find the token associated with username and resolve the URL correctly. pip will also accept the token directly using the form pip install '{packagename} @ git+https://{username}:{token}@github.com/{organization}/{packagename}.git', but uv complains about the URL format in this case, trying to interpret token as a port:

thread 'main' panicked at crates/cache-key/src/canonical_url.rs:113:38:
called `Result::unwrap()` on an `Err` value: InvalidPort
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions