Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git for Windows - Asking for SSH passphrase every push

I installed git for windows today and doing some tests I've seen that in every push I'm asked for the passphrase (something that don't happens at Linux).

I've made some suggestions of another thread, I've seen that i had not configured the ssh-agent, but i did this and the problem persists.

image

Some suggestion? Thanks!

like image 440
Gabriel Markyan Avatar asked Apr 24 '26 05:04

Gabriel Markyan


1 Answers

I had the same issue and waisted couple of hours trying to figure out why windows kept asking me for a ssh password, what helped me is a solution from: https://www.teapotcoder.com/post/how-to-fix-git-ssh-asking-for-password-on-windows-10/

Open PowerShell and type command

Get-Command ssh

If the output of that lists an executable not in your git usr/bin directory then do this:

git config core.sshCommand (get-command ssh).Source.Replace('\','/')

Or, if you want to test this in your current PowerShell session w/o messing with Git config

$ENV:GIT_SSH_COMMAND = (get-command ssh).Source.Replace('\','/')

Why does this work?

When you install git, it comes with ssh. But if you have a newer version of Windows 10, Windows has an install of SSH that comes with it. Installed in C:\Windows\System32\OpenSSH. That gets put into the environment PATH and so testing:

ssh -T [email protected]

Uses your key you added via ssh-add using the Windows provided binaries. But git is using the ssh stuff within the git usr/bin folder. Different set of keys. So you’d end up getting prompted for your passphrase every single time you git pull.

like image 57
AlexS Avatar answered Apr 27 '26 08:04

AlexS



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!