How to run ssh-add on windows?
Original answer using git’s start-ssh-agent
Assurez-vous you have Git installed and have git’s cmd folder in your PATH. Par exemple, on my computer the path to git’s cmd folder is C:\Program Files\Git\cmd
Assurez-vous your id_rsa file is in the folder c:\users\yourusername\.ssh
Restart your invite de commandes if you haven’t already, puis run start-ssh-agent. It will find your id_rsa and prompt you for the passphrase
Update 2019 - A better solution if you’re using Windows 10: OpenSSH is available as part of Windows 10 which makes using SSH from cmd/powershell much easier in my opinion. It also doesn’t rely on having git installed, unlike my previous solution.
Open Manage optional features from the start menu and assurez-vous you have Open SSH Client in the list. If not, vous devriez be able to add it.
Open Services from the start Menu
Scroll down to OpenSSH Authentication Agent > right click > properties
Change the Startup type from Disabled to any of the other 3 options. I have mine set to Automatic (Delayed Start)
Open cmd and type where ssh to confirm that the top listed path is in System32. Mine is installed at C:\Windows\System32\OpenSSH\ssh.exe. If it’s not in the list you may need to close and reopen cmd.
Once you’ve followed these steps, ssh-agent, ssh-add and all other ssh commands should now work from cmd. To start the agent vous pouvez simply type ssh-agent.
- Optional step/troubleshooting: If you use git, vous devriez set the
GIT_SSHvariable d’environnement to the output ofwhere sshwhich you ran before (e.gC:\Windows\System32\OpenSSH\ssh.exe). This is to stop inconsistencies between the version of ssh you’re using (and your keys are added/generated with) and the version that git uses internally. This should prevent issues that are similar to this
Some nice things about this solution:
- You won’t need to start the
(Réponse tronquée)