Skip to content

Add SSH Key #4

Description

@gtbuchanan

Work

$KeyPath = Join-Path "$env:USERPROFILE" ".ssh" "id_ed25519"
dcli note 'SSH Private Key' > $KeyPath
ssh-add $KeyPath

Constraints

This can't be automated through chezmoi, and the ssh-add above won't run on a fresh Windows host. Surfaced while wiring up the SSH-based ~/Code git-repo externals (#6).

  • chezmoi init --ssh clones the dotfiles over SSH, so the key must exist before chezmoi runs at all — a provisioning step inside this repo runs too late (you can't clone the repo that holds it without the key).
  • The git-repo externals (PSRSA is private; the git-unpicked / git-add-mergetool gists use git@gist.github.com) authenticate over SSH during chezmoi apply. GitHub has no anonymous SSH, so they need the key mid-apply too.
  • ssh-add needs the OpenSSH agent, but on Windows the agent (and the canonical OpenSSH client) isn't installed/started until the winget manifest runs during apply — so ssh-add fails pre-init.

Possible direction

  • Split it: before init, write only the key file to its default identity path (~/.ssh/id_ed25519) so ssh uses it directly for the init clone and the externals (passphrase prompted per connection, no agent needed). Defer ssh-add until after the first apply configures OpenSSH.
  • On Windows this is likely a documented manual pre-init step rather than anything chezmoi-managed.

TODO

  • Non-interactive password for ssh-add on Windows (moot if done by hand).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions