You should not use the Open SSH client that comes with Git for Windows. Instead, Windows 10 has its own implementation of Open SSH that is integrated with the system. To achieve this:
- Start the
ssh-agentfrom Windows Services:
- Type
Servicesin theStart MenuorWin+Rand then typeservices.mscto launch the Services window; - Find the
OpenSSH Authentication Agentin the list and double click on it; - In the
OpenSSH Authentication Agent Propertieswindow that appears, chooseAutomaticfrom theStartup type:dropdown and clickStartfromService status:. Make sure it now saysService status: Running.
- Configure Git to use the Windows 10 implementation of OpenSSH by issuing the following command in Powershell:
git config --global core.sshCommand C:/Windows/System32/OpenSSH/ssh.exe
- Configure SSH to automatically add the keys to the agent on startup by editing the
configfile found at$HOME\.ssh\config(full path -C:\Users\%YOUR_USERNAME%\.ssh\config), and add the following lines:
Host *
AddKeysToAgent yes
IdentitiesOnly yes
You can also add the following lines if you generated an SSH key with custom name or multiple SSH keys:
Host github.com
HostName github.com
User your_user_name
IdentityFile ~/.ssh/your_file_name
- Add your SSH key to the
ssh-agentby issuing thessh-addcommand and entering your passphrase:
ssh-add $HOME/.ssh/your_file_name
- Done! Now restart your Powershell and even Windows if necessary.
If this was useful, you can buy me a coffee here. Thank you!

Here is the SO link for line 1: Bad configuration option: \377\376h error when trying to
git pullor similar after the steps above, I found that the encoding was incorrect for myconfigfile contents. It should be simply UTF-8 and is easily changed with VSCode or similar editors.I think it was because I ran an echo command to output my new config file after copy pasting the above config into Powershell so it defaulted to UFT-16 for some reason???
After I fixed the encoding to be UTF-8, everything works flawlessly! Thank you for sharing this gist!