Skip to content

Dear Internet Explorer user: Your browser is no longer supported

Please switch to a modern browser such as Microsoft Edge, Mozilla Firefox or Google Chrome to view this website's content.

Setting up SSH keys in 1Password for Windows

Use the 1Password password manager to store your SSH keys to enable SSH access to GitHub and other servers that you work on.

I like to use SSH keys when accessing GitHub; aside from being more secure than using a password to push commits, it’s a lot easier, too. The 1Password password manager app has a really nice feature where it can manage your SSH keys for you, meaning that they can be synced across devices and are backed-up securely. This feature also works well for remote development via SSH in Visual Studio Code.

The set-up can be a bit tricky, but here is how I do it on Windows 11. The official instructions don’t contain all of these steps, so I find the method below a bit easier to manage.

For this tutorial, I will assume that you have:

There are six steps:

Step 1: Check whether the OpenSSH Authentication Agent service is installed and disable it

In Microsoft Windows, press Win + R on your keyboard to open the Run window, type services.msc and press Enter or select OK.

Locate OpenSSH Authentication Agent and ensure that it is Disabled.

The Services panel in Windows 11.

If this service is not on the system, proceed to Step 2.

Step 2: Enable the 1Password SSH Agent

Go into 1Password and choose Settings > Developer and then click on Use the SSH Agent.

The Developer Settings dialogue box in 1Password.

Step 3: Configure your SSH or Git client

On the command line, enter the following command:

git config --global core.sshCommand "C:/Windows/System32/OpenSSH/ssh.exe"

Step 4: Edit your SSH config file

Open the file at c:\users\<your_user_id>\.ssh\config and add the following lines:

Host github.com
HostName ssh.github.com
Port 443
User git

If this file does not already exist, create it and add the above lines.

Step 5: Update your .gitconfig file

Add the following line to your .gitconfig file, located at c:\users\<your_user_id>\.gitconfig

[core]
	sshCommand = C:/Windows/System32/OpenSSH/ssh.exe
[user]
	email = <your email address>
	name = <your username>
[user]
  signingkey = ssh-ed25519 <your SSH key>
[gpg]
  format = ssh
[gpg "ssh"]
	program = C:\\Program Files\\1Password\\app\\8\\op-ssh-sign.exe
[commit]
  gpgsign = true

Step 6: Check that it’s all working

Enter the following command in Windows Terminal or the Command Prompt:

ssh -T git@github.com

If everything is working, 1Password will launch a prompt seeking your permission to use your SSH keys to authenticate with GitHub:

The 1Password Access Request for Windows Terminal to access a SSH key for GitHub.

You can choose “Approve for all applications” to allow all applications to use the SSH key for this session, which will reduce permission requests.

Selecting “Approve for all applications” reduces the number of requests.

If 1Password is locked, you may also be asked to enter your 1Password password, or Windows Hello PIN (if enabled).

If this is still not working, you may need to adjust the file at c:\users\<your_user_id>\AppData\Local\1Password\config\ssh\agent.toml. This file allows you to control the behaviour of the SSH agent on your specific device.

One problem that I had is that I keep my work-related SSH keys in a 1Password folder called “Work” and my personal ones in “Personal”. On my work machine, I only want to be able to access my work SSH keys, so it’s a good idea to set this specifically:

[[ssh-keys]]
vault = "Work"

If you are expecting to see your SSH keys, and they are not being offered as an option in 1Password, it may be because they are not visible. Use this file to fix that problem.

   

Comments

One response to “Setting up SSH keys in 1Password for Windows”

Have Your Say

The following HTML is permitted:
<a href="" title=""> <b> <blockquote cite=""> <code> <em> <i> <q cite=""> <strike> <strong>

Comments will be published subject to the Editorial Policy.