plain text variable containing the private key

This commit is contained in:
root
2026-06-03 00:35:04 -04:00
parent 994bf3610b
commit 570a58477a
+6 -1
View File
@@ -188,7 +188,12 @@ deploy_to_vps:
- apk add --no-cache openssh-client
# Load the SSH private key stored in the CI variable SSH_PRIVATE_KEY
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
- |
if [ -f "${SSH_PRIVATE_KEY:-}" ]; then
tr -d '\r' < "$SSH_PRIVATE_KEY" | ssh-add -
else
printf '%s\n' "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
fi
- mkdir -p ~/.ssh && chmod 700 ~/.ssh
# Scan and trust the VPS host key (avoids manual known_hosts management)
- ssh-keyscan -H $VPS_IP >> ~/.ssh/known_hosts