Skip to content

feat: add ssh-agent support for passphrase-protected SSH keys#5

Merged
machado144 merged 1 commit intomainfrom
feature/ssh-agent-auth
Mar 8, 2026
Merged

feat: add ssh-agent support for passphrase-protected SSH keys#5
machado144 merged 1 commit intomainfrom
feature/ssh-agent-auth

Conversation

@machado144
Copy link
Contributor

Summary

  • Uses ssh-agent (SSH_AUTH_SOCK) as primary SSH auth method, falling back to key file with empty passphrase
  • Fixes bcrypt_pbkdf: empty password error when using passphrase-protected SSH keys (e.g. id_ed25519)
  • Consolidates duplicated SSH auth logic into a single getSSHAuth() method used by CloneRepository, CloneRepositoryBranch, and ListRemoteBranches

Test plan

  • All existing tests pass (go test ./...)
  • New tests: TestGetSSHAuth_UsesAgentWhenAvailable, TestGetSSHAuth_FallsBackToKeyFile
  • Manual test: yankrun clone --repo git@github.com:AxeForging/cf-worker-template.git succeeds with passphrase-protected ed25519 key via ssh-agent
  • Test with --ssh-key flag pointing to an unprotected key
  • Test without ssh-agent running (unset SSH_AUTH_SOCK)

🤖 Generated with Claude Code

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>
@github-actions
Copy link

github-actions bot commented Mar 8, 2026

StructLint — All checks passed

65 rules validated against .structlint.yaml. No violations found.

View full run · Powered by StructLint

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Core Changes

  • Implemented SSH agent support for Git operations, prioritizing ssh-agent when SSH_AUTH_SOCK is set.
  • Consolidated duplicated SSH authentication logic into a new getSSHAuth() helper method.
  • Improved error messaging for passphrase-protected SSH keys when ssh-agent is 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.

@machado144 machado144 merged commit e095bee into main Mar 8, 2026
6 checks passed
@machado144 machado144 deleted the feature/ssh-agent-auth branch March 8, 2026 17:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant