diff --git a/.github/workflows/deploy-service.yml b/.github/workflows/deploy-service.yml index de67075..009f748 100644 --- a/.github/workflows/deploy-service.yml +++ b/.github/workflows/deploy-service.yml @@ -199,8 +199,15 @@ jobs: mkdir -p ~/.ssh chmod 700 ~/.ssh - printf '%s\n' "${DEPLOY_SSH_PRIVATE_KEY}" > ~/.ssh/id_ed25519 - chmod 600 ~/.ssh/id_ed25519 + # Save private key preserving exact formatting + # Use printf with %b to handle \n sequences, strip trailing whitespace issues + echo "${DEPLOY_SSH_PRIVATE_KEY}" | sed 's/\r//' > ~/.ssh/id_deploy + # Ensure file ends with a newline (required by OpenSSH) + echo "" >> ~/.ssh/id_deploy + chmod 600 ~/.ssh/id_deploy + + # Validate key and show fingerprint for debugging + echo ">>> Private key type: $(ssh-keygen -l -f ~/.ssh/id_deploy 2>&1 || echo 'INVALID KEY')" if [ -n "${DEPLOY_SSH_KNOWN_HOSTS:-}" ]; then printf '%s\n' "${DEPLOY_SSH_KNOWN_HOSTS}" > ~/.ssh/known_hosts @@ -219,7 +226,7 @@ jobs: echo " HostName ${DEPLOY_HOST}" echo " Port ${DEPLOY_PORT}" echo " User ${DEPLOY_USER}" - echo " IdentityFile ~/.ssh/id_ed25519" + echo " IdentityFile ~/.ssh/id_deploy" echo " UserKnownHostsFile ~/.ssh/known_hosts" echo " StrictHostKeyChecking accept-new" echo " ConnectTimeout 15"