Setting up ssh-agent for Sublime Merge on Windows

Setting up ssh-agent for Sublime Merge on Windows

I thought I’d share some SSH set up I had to do recently, as someone may find it useful. I had some trouble getting Sublime Merge to use the keys I had added with ssh-agent and started digging into it. I ended up enabling the Windows provided OpenSSH agent and setting “GIT_SSH” to point at this executable, and now Sublime Merge no longer prompts me for my passphrase. These instructions assume you have an SSH key and config set up already in your home directory.

Start Windows OpenSSH Agent

  1. Open “Services” from the start menu
  2. Scroll down to “OpenSSH Authentication Agent”, right-click, and select “Properties”
  3. In the “General” tab, change the “Startup type” to “Automatic”
  4. Press “Start” to start the service

Set the GIT_SSH environment variable

  1. Open “Command Prompt” from the start menu
  2. Run where ssh, and copy the result using Ctrl + Insert. On my machine this was:
    • C:\Users\username>where ssh
      C:\Windows\System32\OpenSSH\ssh.exe
  3. Open “Edit the system environment variables” from the start menu
  4. Click on “Environment Variables…”
  5. Click “New…” under the “System variables” table, and set GIT_SSH to the directory from the where command above:
    • Variable name: GIT_SSH
    • Variable value: C:\Windows\System32\OpenSSH\ssh.exe
  6. Go back to the “Command prompt” and verify the value using set GIT_SSH. This should print the value of that variable:
    • C:\Users\username>set GIT_SSH
      GIT_SSH=C:\Windows\System32\OpenSSH\ssh.exe

Add your keys to the agent

  1. Open “Command Prompt” from the start menu
  2. Run ssh-add -l to see a list of keys currently tracked by the agent
    • C:\Users\username>ssh-add -l
      2048 SHA256:PVzTWozi...1mRXPQC4 .ssh\id_rsa (RSA)
  3. Run ssh-add .ssh\name_of_key to add your key to the agent. You will probably be prompted for the passphrase
    • C:\Users\username>ssh-add .ssh\name_of_key
      Identity added: .ssh\name_of_key(.ssh\name_of_key)

That should do it! Now when interacting with the remote repositories in Sublime Merge, it shouldn’t re-prompt you for the passphrase every time.

Back to Top