Skip to content

Rust project with git dependencies that require authentication #13358

@kasferdowsi

Description

@kasferdowsi

Summary

Using rust-analyzer as the LSP, in a Rust project with a dependency on a private git repo

my-dep = { git = "ssh://...", rev = "..." }

if the matching ssh key has a passphrase, opening Helix after updating the dependency rev but before running cargo c (or any other Cargo command that pulls the new dependency) breaks Helix.

This seems to happen because the Enter passphrase for key... prompt and Helix are competing for user input?

Reproduction Steps

I tried this:

  1. In an existing Rust project with a git dependency using an ssh key that has a passphrase, I updated the rev for the dependency in Cargo.toml in Helix.
  2. Closed Helix.
  3. Opened a .rs file in the project in helix and started editing.

I expected this to happen:

  • Getting a prompt for entering the ssh key passphrase, or
  • Getting some error about the dependency being out of date

Instead, this happened:

  • Helix behaved erratically, where some of my key inputs were received and others were not, and
  • Some lines in my buffer doubles and overall the buffer lines seemed to "break", and
  • I saw a Enter passphrase for key '...': randomly printing at seemingly random places in my terminal.

Helix log

~/.cache/helix/helix.log
2025-04-15T11:05:57.878 helix_view::editor [WARN] editor warning: cargo check failed to start: Cargo watcher failed, the command produced no valid metadata (exit code: ExitStatus(unix_wait_status(25856))):
    Updating git repository `ssh://git@github.com/REDACTED.git`
git@github.com: 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 get `REDACTED` as a dependency of package `REDACTED vREDACTED (REDACTED)`

Caused by:
  failed to load source for dependency `REDACTED`

Caused by:
  Unable to update ssh://git@github.com/REDACTED.git?rev=REDACTED

Caused by:
  failed to fetch into: /REDACTED/.cargo/git/db/REDACTED

Caused by:
  revision REDACTED not found

Caused by:
  process didn't exit successfully: `git fetch --no-tags --force --update-head-ok 'ssh://git@github.com/REDACTED.git' '+REDACTED:refs/commit/REDACTED'` (exit status: 128)

Failed to read Cargo metadata with dependencies for `/REDACTED/Cargo.toml`: Failed to run `cd "REDACTED" && RUSTUP_TOOLCHAIN="/REDACTED/.rustup/toolchains/stable-aarch64-apple-darwin" "/REDACTED/.cargo/bin/cargo" "metadata" "--format-version" "1" "--manifest-path" "/REDACTED/Cargo.toml" "--filter-platform" "aarch64-apple-darwin"`: `cargo metadata` exited with an error:     Updating git repository `ssh://git@github.com/REDACTED.git`
git@github.com: 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 get `REDACTED` as a dependency of package `REDACTED vREDACTED (REDACTED)`

Caused by:
  failed to load source for dependency `REDACTED`

Caused by:
  Unable to update ssh://git@github.com/REDACTED.git?rev=REDACTED

Caused by:
  failed to fetch into: /REDACTED/.cargo/git/db/REDACTED

Caused by:
  revision REDACTED not found

Caused by:
  process didn't exit successfully: `git fetch --no-tags --force --update-head-ok 'ssh://git@github.com/REDACTED.git' '+REDACTED:refs/commit/REDACTED'` (exit status: 128)

Unfortunately I can't post most of the log file, but I included the section with the relevant warning above.

Platform

macOS

Terminal Emulator

wezterm 20240203-110809-5046fc22

Installation Method

brew

Helix Version

helix 25.01.1 (e7ac2fc)

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions