Skip to content
Versora

Manual

Servers and accounts

SSH keys

7 min read

On this page

SSH remotes ([email protected]:equipe/app.git) authenticate with an SSH key instead of a token. The SSH and GPG keys page in Preferences gathers everything about those keys: seeing the ones you have, generating a new one, sending the public key to the server, testing the connection, using the Windows agent and signing commits.

Versora never reads or shows the private key. It is opened only by ssh-keygen or ssh themselves. Only the public key is copied or uploaded.

Where to find it

  • Preferences (Ctrl+,) › SSH and GPG keys.
  • Palette (Ctrl+P): "Preferences: SSH and GPG keys" (detail: "Generate, copy, test and upload keys to GitLab/GitHub; sign commits").

The top of the page shows the commit signing in effect ("Commit signing: on" or "off", with the key and the format) and the Change in Commit link.

The SSH key list

The group's note says which folder is read (usually C:/Users/<you>/.ssh) and which ssh Git uses: the one that ships with Git, the one on the PATH or the one in core.sshCommand.

Each key shows the file name, the type, the fingerprint (SHA256) and badges:

BadgeMeaning
with passphraseThe private key is protected by a passphrase.
no passphraseAnyone who has the private key file can use it.
no private keyOnly the public key is in this folder.
in agentThe key is loaded in the Windows agent.
signs commitsIt's the signing key in effect.

Buttons on each key:

  • Copy public key: copies the line from the .pub file ("Public key copied to the clipboard.").
  • Upload to server…: adds the public key to your GitLab or GitHub account (see below).
  • Use to sign commits…: sets up commit signing with this key (see below).
  • Add to agent: loads the key into the Windows agent (shown when the agent is running and the key isn't in it yet).

Generating a new key

Step by step

  1. Click Generate new SSH key….
  2. In File name (in C:/Users/ana/.ssh), check the suggested name (for example, id_ed25519_gitlab). Use letters, numbers, periods, hyphens and underscores.
  3. In Comment (usually your email), check the email.
  4. In Key passphrase (optional, recommended) and Confirm passphrase, type the passphrase. Empty = no passphrase.
  5. Click Generate SSH key. You see "Key id_ed25519_gitlab created. Now copy the public key or upload it to a server."

The form's note explains: type ed25519 (recommended by GitLab and GitHub). With a passphrase, ssh asks for it when the key is used, and Versora shows the prompt, unless the key is in the Windows agent. The passphrase goes straight to ssh-keygen and isn't stored.

What Versora does

bash
ssh-keygen -q -t ed25519 -C "[email protected]" -f C:/Users/ana/.ssh/id_ed25519_gitlab

An existing key is never overwritten.

Uploading the key to the server

Step by step

  1. On the key, click Upload to server….
  2. The Upload the SSH key to a server dialog shows the key ("Key id_ed25519 (ED25519) · SHA256:…") and reminds you: "The public key will be added to the account that owns the selected server's token. Only the public key leaves this machine."
  3. In Server, choose the server ("gitlab.exemplo.com — GitLab, ana").
  4. In Key title, check the title (it comes with the computer name and "(Versora)").
  5. On GitHub, On GitHub, also add it as a commit signing key (checked by default) adds the same key to verify signatures.
  6. Click Upload. The Key added dialog confirms ("The SSH key was added on gitlab.exemplo.com.") and offers Open the keys page.

Without a GitLab or GitHub with a registered token, the dialog explains which scope to create and offers Open Git servers:

  • GitLab: personal access token with the api scope;
  • GitHub: token with write:public_key (and write:ssh_signing_key for signing).

Without a token, copy the public key and paste it on your account's keys page.

Testing the SSH connection

Step by step

  1. In the Test the SSH connection group, in Server (e.g., gitlab.company.com, [email protected] or host:port), type the server. The servers of the open repository's remotes appear as suggestions.
  2. Click Test connection.
  3. The result appears right after, for example "Connected to GitLab as @ana. The SSH key works." The full output is in ssh response.

The test uses the same ssh as Git. On a new server, Versora asks whether you trust its identity (see below).

Possible results

  • "The server rejected your keys. Add the public key to your account (on GitLab: Edit profile → Access → SSH keys; on GitHub: Settings → SSH and GPG keys) or send it with the "Upload to server" button."
  • "Couldn't find the server. Check the name (and the VPN, if the server is internal)."
  • "The server refused the connection: SSH may be on another port (e.g., gitlab.company.com:2222) or turned off."
  • "The server didn't respond in time: check the network, VPN, firewall or port."
  • "ssh rejected a key file because other accounts on this computer can read it. Restrict the file's permissions to your user."
  • "The key passphrase is incorrect."
  • "Too many keys were tried and the server closed the connection. Use a specific key for this server (~/.ssh/config file)."
  • "WARNING: the server's identity has changed since the last connection…": it may be a legitimate change of the server's key, or someone impersonating it. Check with whoever manages the server before removing the old line from the known_hosts file.

New SSH server and key passphrase

In any SSH operation (fetch, pull, push, clone, test), Versora shows the ssh prompts in a dialog:

  • Confirm SSH server: "This is the first connection to gitlab.exemplo.com, and SSH doesn't know its key yet." with the fingerprint. Confirm with Trust and continue only if it belongs to the server you expect (the server administrator or the GitLab/GitHub documentation can tell you). The key is remembered and you won't be asked again.
  • SSH key passphrase: "The SSH key below is protected by a passphrase. Enter it to use the key for this operation.", with the Key passphrase field and Continue.

The Windows SSH agent

With the Windows agent (the "OpenSSH Authentication Agent" service) running and Git using Windows OpenSSH, a key with a passphrase is unlocked only once, instead of asking for the passphrase on every network operation.

The Windows SSH agent group shows the state:

  • "The Windows agent is running, with 1 key loaded.";
  • "The Windows service “OpenSSH Authentication Agent” is disabled." (or stopped), with the command to turn it on. Versora doesn't change Windows services: open PowerShell as administrator and run the command shown (the Copy button copies it), or use Services (services.msc) with the startup type "Automatic";
  • "Windows OpenSSH isn't installed…": install it from Settings → System → Optional features → "OpenSSH Client".
PowerShell
Get-Service ssh-agent | Set-Service -StartupType Automatic; Start-Service ssh-agent

Making Git use Windows OpenSSH

If Git uses another ssh (the one that ships with Git), it doesn't query the Windows agent. The group warns you and offers Use Windows OpenSSH in Git…:

  1. The Use Windows OpenSSH in Git dialog explains that it will write core.sshCommand to the global Git configuration. Servers already known to the other ssh may ask for confirmation again on the first connection.
  2. Click Use Windows OpenSSH. You see "Git now uses Windows OpenSSH."

To go back: Go back to Git's ssh, which removes core.sshCommand from the global configuration.

bash
# Use Windows OpenSSH (the ssh.exe from System32\OpenSSH, written with forward slashes)
git config --global core.sshCommand C:/Windows/System32/OpenSSH/ssh.exe
# Go back to Git's ssh
git config --global --unset-all core.sshCommand

Signing commits with the SSH key

On Windows, signing with an SSH key is usually less work than with GPG: it doesn't depend on gpg-agent, and the same key works for connecting and for signing.

  1. On the key, click Use to sign commits….
  2. The Sign commits with this SSH key dialog explains what will be written to the global Git configuration: commit.gpgsign = true, gpg.format = ssh and user.signingkey with the path to the public key.
  3. With your email set in Preferences › Profile, Versora also adds the key to the allowed_signers file (in the .ssh folder) and points gpg.ssh.allowedSignersFile to it. That's what makes Git recognize your signatures as valid.
  4. Click Use for signing. You see "Commits will now be signed with the SSH key id_ed25519."

To sign in a single repository only, use Preferences › Commit (see Commits). For the server to show the commits as verified, also add the key as a signing key (on GitHub, the checkbox in the upload does that).

How to undo

Nothing here is part of Ctrl+Z. Generating a key creates files in .ssh; configuration changes (core.sshCommand, signing) are undone with the buttons themselves or in Preferences › Commit.

Caveats and messages

  • "A key named id_ed25519 already exists in C:/Users/ana/.ssh. Choose another name."
  • "Invalid file name: use letters, numbers, periods, hyphens and underscores (e.g., id_ed25519_gitlab)."
  • "The passphrases don't match." and "The passphrase can't contain line breaks."
  • "This key is already registered on GitLab (in this or another account).": the server doesn't accept the same key twice.
  • "The token registered for gitlab.exemplo.com can't add keys. Create a token with the "api" scope and update it in Git servers."
  • "The Windows agent (OpenSSH Authentication Agent) isn't running.": turn on the service as shown above.
  • "Set your email in Profile so Git can also verify your signatures (allowed_signers)."
  • Preferences › SSH and GPG keys. The company policy can hide this page (preferences.hidden: [keys]). See Administrators.
  • Preferences › Commit: global and per-repository signing.

See also