|
SSH private key needs to have a new line at the end of the file but the new line is not preserved when using an env var. |
Replies: 2 comments
|
[env]
SSH_PRIVATE_KEY = { provider = "...", value = "...", as_file = true }
That only helps if the newline is still in the stored value. Check with |
|
Yes, I found two ways the final newline can be lost:
That is also why I opened #730 to add an exact file-input path. After it lands, the intended workflow is: fnox set SSH_PRIVATE_KEY --from-file ~/.ssh/id_ed25519Then configure the secret with Until then, for a normal SSH key with one final newline, this preserves it explicitly in bash/zsh: key="$(cat ~/.ssh/id_ed25519)"
fnox set SSH_PRIVATE_KEY "${key}"$'\n'AI-assisted — Tool: Codex; model: openai/gpt-5; version: unavailable. |
Yes,
as_file = trueis the right delivery mode when the consumer expects a file path, but it only writes the value that was stored; it cannot restore a newline that was already removed.I found two ways the final newline can be lost:
fnox set SSH_PRIVATE_KEY < ~/.ssh/id_ed25519currently trims stdin before storing it.fnox set SSH_PRIVATE_KEY "$(cat ~/.ssh/id_ed25519)"loses trailing newlines through shell command substitution.That is also why
--base64-encodedid not help when fnox read the original key from stdin: trimming happened before encoding.I opened #730 to add an exact file-input path. After it lands, the intended workflow is: