feat: add ssh-agent support for passphrase-protected SSH keys#5
Merged
machado144 merged 1 commit intomainfrom Mar 8, 2026
Merged
feat: add ssh-agent support for passphrase-protected SSH keys#5machado144 merged 1 commit intomainfrom
machado144 merged 1 commit intomainfrom
Conversation
Use ssh-agent (via SSH_AUTH_SOCK) as the primary SSH auth method, falling back to key file only when agent is unavailable. This fixes clone failures with passphrase-protected keys like id_ed25519. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
StructLint — All checks passed65 rules validated against
|
There was a problem hiding this comment.
Core Changes
- Implemented SSH agent support for Git operations, prioritizing
ssh-agentwhenSSH_AUTH_SOCKis set. - Consolidated duplicated SSH authentication logic into a new
getSSHAuth()helper method. - Improved error messaging for passphrase-protected SSH keys when
ssh-agentis not available, guiding users to add their key to the agent.
Verdict
Approve: The changes correctly implement SSH agent support and refactor existing authentication logic, improving robustness and user experience for SSH-based Git operations. The new tests adequately cover the added functionality.
Code review performed by GEMINI - gemini-2.5-flash.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
SSH_AUTH_SOCK) as primary SSH auth method, falling back to key file with empty passphrasebcrypt_pbkdf: empty passworderror when using passphrase-protected SSH keys (e.g.id_ed25519)getSSHAuth()method used byCloneRepository,CloneRepositoryBranch, andListRemoteBranchesTest plan
go test ./...)TestGetSSHAuth_UsesAgentWhenAvailable,TestGetSSHAuth_FallsBackToKeyFileyankrun clone --repo git@github.com:AxeForging/cf-worker-template.gitsucceeds with passphrase-protected ed25519 key via ssh-agent--ssh-keyflag pointing to an unprotected keySSH_AUTH_SOCK)🤖 Generated with Claude Code