Skip to content

git-fetch-with-cli doesn't work well with custom registries #6241

@sfackler

Description

@sfackler

The git repository URLs for custom registries are currently forbidden from containing credentials. Unfortunately, that interacts poorly with the git-fetch-with-cli option since command-line git will default to using your username as the username when authenticating. However, a common configuration (e.g. with Github) is to use a single user named git for all users, so you end up with an error:

    Updating crates.io index
    Updating `ssh://my-git-server/my-registry-index` index
sfackler@my-git-server: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
error: failed to load source for a dependency on `some-crate`

Caused by:
  Unable to update registry `ssh://my-git-server/my-registry-index`

Caused by:
  failed to fetch `ssh://my-git-server/my-registry-index`

Caused by:
  process didn't exit successfully: `git fetch --tags --quiet 'ssh://my-git-server/my-registry-index' 'refs/heads/master:refs/remotes/origin/master'` (exit code: 128)

Note how the Permission denied message tried sfackler@my-git-server rather than git@my-git-server which would have worked.

It seems like we should relax the restriction on credentials in custom registry configurations to only forbid passwords and not usernames.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions