TortoiseGit with openssh key not authenticating using ssh-agent

前端 未结 8 1037
暗喜
暗喜 2020-11-30 01:03

I\'m setting up a git environment on Windows XP (msysGit 1.7.11, TortoiseGit 1.7.14) and trying to achieve following points :

  • ssh connection on a port differ
8条回答
  •  执念已碎
    2020-11-30 01:37

    Since the explanations here are a bit outdated, I decided to post my solution.

    I am using Git Bash and TortoiseGit 2.8.0 in Windows 10, which are common nowadays.

    I set ssh.exe as SSH client in Settings->Network as explained in previous posts.

    I created a script with the following commands, as explained in a previous comment. You might also want to set a HOME environment variable, in case your system does not do it automatically. Assuming your home is in drive H:\ you can add the following lines:

    SETX HOME /h
    CALL "C:\Program Files\Git\cmd\start-ssh-agent.cmd"
    SETX SSH_AUTH_SOCK "%SSH_AUTH_SOCK%"
    SETX SSH_AGENT_PID "%SSH_AGENT_PID%"
    

    I added the script using Win logo+R shell:startup to the startup folder. Alternatively, you can add the script to the registry to guarantee that it runs before other processes:

    HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run
    

    Make sure to type exit to close the console and allow for the variable to be set for future processes.

提交回复
热议问题