-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Description
Describe the bug
LazyGit fails during Git operations (e.g. rebase) when using an SSH agent that holds the private key externally and no local SSH private key file exists. Even though Git CLI works correctly via SSH_AUTH_SOCK, LazyGit errors out saying no private key is found.
In my setup, SSH private keys are managed by an authenticator-based SSH agent (Bitwarden). Only the public key exists locally.
To Reproduce
- Configure an SSH agent that stores the private key externally (e.g. Bitwarden).
- Ensure no SSH private key files exist locally (only public keys).
- Export
SSH_AUTH_SOCKin the shell (e.g. via.zshrc). - Verify Git CLI works (
git fetch,git push, etc.). - Open LazyGit.
- Perform a Git operation that requires writing commits (e.g. interactive rebase with squash).
Expected behavior
LazyGit should rely on the SSH agent (via SSH_AUTH_SOCK) in the same way Git CLI does and should not require a local SSH private key file to be present.
Actual behavior
LazyGit fails with an error indicating that a private key is missing, even though the SSH agent is correctly configured and Git CLI works.
Example error during rebase:
Rebasing (2/7)Rebasing (3/7)Rebasing(4/7)Rebasing(5/7)error: No private key found for public key "/Users/***/.ssh/***.pub"?
error: failed to write commit object
hint: Could not execute the todo commandScreenshots
Version info
lazygit --version
commit=, build date=, build source=Homebrew, version=0.57.0, os=darwin, arch=arm64, git version=2.52.0git --version
git version 2.52.0Additional context
Using external SSH agents without storing private keys on disk is a common and security-recommended workflow. This issue suggests LazyGit may be bypassing Git’s normal SSH handling or invoking SSH in a way that ignores the agent.