Windows 的 Git SSH 客户端和 .ssh/config 文件的错误路径

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9513712/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 09:17:31  来源:igfitidea点击:

Git SSH client for windows and wrong path for .ssh/config file

windowsgitssh

提问by ATom

I installed Git-1.7.9-preview20120201.exe, and when I try to access my repository via SSH it failed.

我安装了 Git-1.7.9-preview20120201.exe,当我尝试通过 SSH 访问我的存储库时它失败了。

I investigated and found that if I run SSH -T [email protected], SSH doesn't load ~/.ssh/config where a custom port is defined.

我调查并发现,如果我运行SSH -T [email protected],SSH 不会加载定义自定义端口的 ~/.ssh/config。

When I try SSH -F c:\users\tomas\.ssh\config [email protected]everything is OK.

当我尝试SSH -F c:\users\tomas\.ssh\config [email protected]一切正常。

I used Process Monitor and found that SSH is trying to find \\\\.ssh\confighere C:\Windows\CSC\v2.0.6\namespace\.ssh.

我使用了 Process Monitor,发现 SSH 试图在\\\\.ssh\config这里找到C:\Windows\CSC\v2.0.6\namespace\.ssh

Why?

为什么?

How I can force it to use normal path? %HOMEPATH%\.ssh\config?

如何强制它使用正常路径?%HOMEPATH%\.ssh\config?

采纳答案by ATom

I found that windows msygit port store ssh config here <installPath>\Git\etc\ssh\ssh_config

我发现 windows msygit 端口在这里存储了 ssh 配置 <installPath>\Git\etc\ssh\ssh_config

回答by vsrikarunyan

set the HOMEenvironment variable pointing to %USERPROFILE%for ssh to pick it up. This usually seems to be the problem for many unix solutions that run on windows.

设置HOME指向%USERPROFILE%ssh的环境变量以获取它。这通常似乎是在 Windows 上运行的许多 unix 解决方案的问题。

Fast access to set user env variables:

快速访问设置用户环境变量:

Start > Type "env" > Select "Environmental variables for your account"

Start > Type "env" > Select "Environmental variables for your account"