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.
Some suggestion? Thanks!
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 git@github.com
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.
Try below
User Git bash instead of powershell
Copy your key file to ~/.ssh
paste below code to your ~/.profile or ~/.bashrc
Restart Git Bash
env=~/.ssh/agent.env agent_load_env () { test -f "$env" &&. "$env" >| /dev/null; } agent_start () { (umask 077; ssh-agent >| "$env"). "$env" >| /dev/null; } agent_load_env # agent_run_state: 0=agent running w/ key; 1=agent w/o key; 2= agent not running agent_run_state=$(ssh-add -l >| /dev/null 2>&1; echo $?) if [; "$SSH_AUTH_SOCK" ] || [ $agent_run_state = 2 ]; then agent_start ssh-add elif [ "$SSH_AUTH_SOCK" ] && [ $agent_run_state = 1 ]; then ssh-add fi unset env
On start up git bash will prompt or passphrase of key and then work seamlessly. Script will also start SSH agent and add key file using ssh-add
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.