From 4e4862a427e96bbeeec31cd3be14d9cae619e407 Mon Sep 17 00:00:00 2001 From: Remo Senekowitsch Date: Thu, 10 Apr 2025 20:13:41 +0200 Subject: [PATCH] feat: inline public ssh key in verification command This makes it easier for people to verify their SSH key with various setups. People with a key stored in a file won't have to manually substitute the correct file path anymore. People who store their SSH key in a password manager and access it via an ssh-agent won't have to copy the private key to a temporary file or figure out the process substitution thing anymore. A slight disadvantage is that the fish shell doesn't have the same syntax for process substitution as POSIX shells. For that reason, a default-collapsed box with a custom command for fish users is provided, just like for the Windows shells. The Windows shells do not have an equivalent to process substitution, so those commands remain unchanged. --- templates/user/settings/keys_ssh.tmpl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/templates/user/settings/keys_ssh.tmpl b/templates/user/settings/keys_ssh.tmpl index b8783dead0..083a3eb541 100644 --- a/templates/user/settings/keys_ssh.tmpl +++ b/templates/user/settings/keys_ssh.tmpl @@ -78,7 +78,12 @@

{{ctx.Locale.Tr "settings.ssh_token_help"}}

-

echo -n '{{$.TokenToSign}}' | ssh-keygen -Y sign -n gitea -f /path_to_PrivateKey_or_RelatedPublicKey

+

echo -n '{{$.TokenToSign}}' | ssh-keygen -Y sign -n gitea -f <(echo "{{.Content}}")

+
+ Fish shell +

echo -n '{{$.TokenToSign}}' | ssh-keygen -Y sign -n gitea -f (echo "{{.Content}}" | psub)

+
+
Windows PowerShell

cmd /c "<NUL set /p=`"{{$.TokenToSign}}`"| ssh-keygen -Y sign -n gitea -f /path_to_PrivateKey_or_RelatedPublicKey"