Skip to content

fix: return error on invalid SSH private key instead of silent nil#151

Closed
creydr wants to merge 1 commit into
mainfrom
fix/ssh-key-error-handling
Closed

fix: return error on invalid SSH private key instead of silent nil#151
creydr wants to merge 1 commit into
mainfrom
fix/ssh-key-error-handling

Conversation

@creydr
Copy link
Copy Markdown
Collaborator

@creydr creydr commented May 20, 2026

Summary

  • When gitssh.NewPublicKeys failed (e.g. corrupted/invalid key), getSSHClientOptions silently returned nil, causing the clone to proceed without authentication and fail with a confusing error
  • Changed getSSHClientOptions and getClientOptions to return ([]client.Option, error) so the key parse error is propagated to CloneRepository
  • Users now get a clear "failed to parse SSH private key" message instead of a misleading auth failure

When gitssh.NewPublicKeys failed (e.g. corrupted key),
getSSHClientOptions silently returned nil, causing the clone to proceed
without authentication and fail with a confusing error. Now the key
parse error is propagated through getClientOptions to CloneRepository,
giving users a clear "failed to parse SSH private key" message.
@creydr creydr enabled auto-merge May 20, 2026 09:05
@creydr creydr closed this May 20, 2026
auto-merge was automatically disabled May 20, 2026 09:24

Pull request was closed

@creydr creydr deleted the fix/ssh-key-error-handling branch May 20, 2026 09:24
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