如何获取git和copSSH在正确的目录中查找密钥? [英] How can I get git and copSSH to look in the correct directory for keys?
问题描述
我刚刚为Windows安装了copSSH.当我启动它时,我得到一个目录 C:\ copSSH \ home \ Nick \ .ssh
,其中包含我的发布和私钥.
当我使用
通过Cygwin bash窗口访问此目录时ssh user @ host
我很高兴登录.但是,当我使用
打开git bash窗口时git clone ssh://user @ host
它尝试访问 C:\ Users \ Nick \ .ssh
中的密钥,这给了我一个权限被拒绝"错误.如何修复git,以便所有内容都使用 C:\ copSSH \ home \ Nick \ .ssh
作为目录?
copSSH设置的环境变量与git bash Windows中发现的变量不同.(另请参见 Windows上的OpenSSH )
您可能需要将$ HOME变量重新定义为copSSH使用的变量.有关HOME重新定义的其他示例,请参见此线程.>
默认情况下, HOME =/c/Users/Nick
.
试试:
导出HOME =/c/copSSH/home/Nick
要使其永久化(每次打开bash shell时),您可以尝试将此行添加到 .bashrc
的 c:\ Users \ Nick
下(代码> c:\ Users \ Nick \ .bashrc )
I just installed copSSH for Windows. When I boot it up I get a directory C:\copSSH\home\Nick\.ssh
which has my pub and private key it.
When I access this directory via a Cygwin bash window using
ssh user@host
I get happily logged in. However, when I open a git bash window with
git clone ssh://user@host
it tries to access the keys in C:\Users\Nick\.ssh
, which gives me a "permission denied" error. How can I fix git so everything is using C:\copSSH\home\Nick\.ssh
as the directory?
The environment variables set by copSSH are not the same than the one found in a git bash Windows. (see also OpenSSH on Windows)
You may need to redefine the $HOME variable to the one used by copSSH. See this thread for additional example of HOME redefinition.
By default, HOME=/c/Users/Nick
.
Try:
export HOME=/c/copSSH/home/Nick
To make it permanent (each time you open a bash shell), you can try adding this line to your .bashrc
under c:\Users\Nick
(c:\Users\Nick\.bashrc
)
这篇关于如何获取git和copSSH在正确的目录中查找密钥?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!