Closed
fix: SSH agent not started before git clone/push in deploy_debian_repo workflow#773
Conversation
… workflow Root cause: the 'Configure SSH for Debian repository push' step wrote the private key to a file but never started ssh-agent, so SSH_AUTH_SOCK was unset in the next step. Additionally, ssh-keyscan exits 0 even when it produces no output (e.g. port-22 temporarily unreachable), leaving an empty known_hosts and triggering 'Host key verification failed.' Fix: - Start ssh-agent and export SSH_AUTH_SOCK / SSH_AGENT_PID to GITHUB_ENV so the agent is available to subsequent steps. - Load the deploy key via `ssh-add -` (from stdin, never touches disk). - Capture ssh-keyscan output and fail fast if it is empty, then write verified host keys to known_hosts with correct permissions. - Set core.sshCommand with IdentitiesOnly=yes and StrictHostKeyChecking=yes so git explicitly uses only the agent key and enforces host verification.
Copilot
AI
changed the title
[WIP] Fix host key verification failure in Debian repo workflow
fix: SSH agent not started before git clone/push in deploy_debian_repo workflow
Jul 11, 2026
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.
The "Commit and push Debian repository" step failed with
Host key verification failed/ exit 128 because: (1) nossh-agentwas started, leavingSSH_AUTH_SOCKunset in the subsequent step's shell process; (2)ssh-keyscanexits 0 even on empty output, silently producing an unusableknown_hosts.Changes
eval "$(ssh-agent -s)"and exportSSH_AUTH_SOCK/SSH_AGENT_PIDto$GITHUB_ENVso the agent is reachable in downstream stepsssh-add - <<< "${DEBIAN_REPO_SSH_PRIVATE_KEY}"loads the key into the agent via stdin (never written to disk)known_hosts: capturessh-keyscan -t ed25519,rsa,ecdsa github.comoutput into a variable and fail fast if empty before appending toknown_hostscore.sshCommand: setssh -o IdentitiesOnly=yes -o StrictHostKeyChecking=yesso git uses only the agent key and keeps strict host-key verification