I'm using Pageant (on Windows 7) to login to SSH connections with private keys .ppk files. However each time I start the program I have to add all the keys I want again and enter their encryption keys. How can I get it to save this stuff?


6 Answers 6


Pageant cannot save the encryption keys for the key files. That would defeat the entire purpose of encrypting the keys in the first place...

However, if you edit the keys with PuTTYgen, you can store the keys unecrypted. Just leave the password field blank.

  • 1
    Note that unencrypted keys are quite insecure and anyone obtaining the key files has access to the servers for that key.
    – Ikke
    Jan 23, 2014 at 8:25
  • 9
    I don't think he's talking about saving the passwords for the keys. Pageant totally forgets about the entire existence of .ppk files it has loaded. Even ones without password protection. That's clearly stupid.
    – Timmmm
    Jul 19, 2017 at 8:46

As mentioned already, you can add the key locations as command-line arguments to pageant. If you are running pageant from the Windows Start-Up folder, simply pass the key locations in as command-line arguments in the shortcut. For example:

"c:\program files\putty\pageant.exe" "c:\mykey.ppk"

For a comprehensive guide to setting this up, see the this page.

  • 1
    Running that command in a batch file seems to freeze the command line. It never return from the execution. It does however starts it fine, but control never comes back to the batch file.
    – Achshar
    Jun 24, 2013 at 1:53
  • @Achshar the solution described above doesn't need a batch file; you can simply create a Windows shortcut that points to pageant.exe, then add the .ppk's path to the end of the Target field in the shortcut's Properties. If you do want to run this in a .bat, you'd need to use START C:\path\to\pageant.exe ... to kick off pageant in a separate process. Sep 29, 2016 at 14:08
  • Will pageant ask a password and when?
    – CoolMind
    Mar 12, 2019 at 8:28
  • If you want to defer the password prompt to decrypt encrypted keys until you actually try to login to something that uses the key, use "c:\program files\putty\pageant.exe" --encrypted "c:\mykey.ppk". Pageant will then prompt for the passphrase on first use of the key, and then keep the decrypted key cached for further use. Feb 22 at 8:54

The simplest way to do this in Windows is to create a specially crafted shortcut inside the Startup folder (Start -> Programs -> Startup):

Note: This only works if you did not set a password on your key

  1. go to Start menu, then "Programs", right click on the Startup folder and choose "Open"
  2. right-click inside the folder and select "New", then "Shortcut"
  3. browse to your PuTTY installation, for example "C:\Program Files (x86)\Atlassian\SourceTree\tools\putty" and select "pageant.exe"
  4. name the shortcut whatever you want
  5. right-click the newly created shortcut and select "Properties" You should see something like this: enter image description here

Append its full path to your "Target" field like so: Target: "C:\Program Files (x86)\Atlassian\SourceTree\tools\putty\pageant.exe" C:\Git\Key.ppk

You should now see:

enter image description here

This particular set up is for GitFlow and Jira.

  • Apparently copied (in part) from blog.shvetsov.com/2010/03/…
    – isherwood
    Feb 12, 2016 at 15:14
  • @isherwood, My work blocks that link because it categorizes the blog as games.
    – crh225
    Dec 12, 2016 at 19:33
  • 1
    step 1 can be simplified by: winkey + r, 'shell:startup'
    – Aequitas
    Oct 26, 2018 at 0:16

You can add all keys in command-line, but passwords must be entered by hand


If you use SourceTree, make sure you fill in the 'SSH Key' option in the settings. It will automatically pass it to Pageant when it runs it.


You can also simply not close pagent If that fits with your security model. I have mine configured to auto-start with my private key when my system boots up, so that when I load my desktop I just type in my password, and I'm good to go until I shut my system down. You'd want to set a screensaver password and an aggressive screensaver activation to make sure your system is quickly protected in the event you leave it, though.

  • You can't "not close" a program on computer restart! Oct 26, 2022 at 0:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .