Skip to content

Support multi ssh-keys in git client#6776

Open
Bibisha06 wants to merge 1 commit into
pipe-cd:masterfrom
Bibisha06:feature
Open

Support multi ssh-keys in git client#6776
Bibisha06 wants to merge 1 commit into
pipe-cd:masterfrom
Bibisha06:feature

Conversation

@Bibisha06
Copy link
Copy Markdown

What this PR does:

This PR implements support for multiple SSH keys in the Piped Git configuration. It introduces a new sshKeys list field to PipedGit while maintaining full backward compatibility with the existing single-key setup.

Key changes:

  • Prioritized Config: Refactored AddSSHConfig to generate a composite ~/.ssh/config file that writes the legacy host entry first followed by entries in the sshKeys list, preserving SSH's first-match-wins logic.
  • Secure File Handling: Identity files are created in a temporary directory with strict 0600 permissions via a new writeSSHKeyFile helper.
  • Improved Lifecycle: The Git package now returns a temporary directory path to the Piped runtime, ensuring all generated identity files are removed in a single os.RemoveAll call.
  • Validation: Added strict validation in pkg/configv1 to prevent duplicate host mappings and ensure configuration integrity.

Why we need it:

Some repositories may require distinct SSH keys (e.g., repository-specific deployment keys or keys across different organizations/domains) that cannot be handled by a single global SSH key.

Which issue(s) this PR fixes:

Fixes #4311

Does this PR introduce a user-facing change?:

  • How are users affected by this change: Users can now optionally define multiple SSH keys in their Piped configuration. Existing configurations continue to work without modification.
  • Is this breaking change: No.
  • How to migrate (if breaking change): N/A.

Copilot AI review requested due to automatic review settings May 15, 2026 16:19
@Bibisha06 Bibisha06 requested a review from a team as a code owner May 15, 2026 16:19
Signed-off-by: Bibisha B <bibisha2006z@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support multi ssh-keys in git client

1 participant