在Windows命令提示符下ssh验证git访问? [英] ssh authenticated git access at windows command prompt?
问题描述
我注意到,当安装git时,它提供了设置选项在Windows提示符下使用git,它将git放在windows路径上。
有没有一种方法可以设置它以便使ssh验证正常工作?
当我尝试执行访问远程设备的git命令时,我得到permission denied(publickey)。
(编辑)我已经将%HOME%设置为指向我的Windows主目录,并且在那里有一个.ssh文件夹,其中包含在gitbash shell下工作的id文件。
我明白答案很可能是不,这就是为什么GitBash存在。但是 - 确实知道这很好。
如果答案是否,它会让你想知道为什么你会把git放在你的windows路径上?
ssh访问可以在普通的DOS会话中正常工作。
您只需要定义 C:\ Users \YourAccount\\ \\.ssh
并在其中添加您的 id_rsa
和 id_rsa.pub
。
通过启动您的git会话 git-cmd.bat
,它会将%HOME%
定义到 C:\ Users \YourAccount
:这是什么使ssh工作。
这应该把你的msysgit / bin安装到你的PATH 。
我真的推荐通过msi(微软安装程序)进行安装,而不是通过简单的解压缩存档( portable version PortableGit-xyz-preview201ymmdd.7z
)
以及 OP GreenAsJade 的评论指出了 GIT_SSH
必须指向 plink.exe
。
There are many fine instructions about how to work with git under windows using GitBash.
I note that when git is installed, it offers the option of "set up for using git from the windows prompt", which puts git on the windows path.
Is there some way to set this up so that ssh authentication works?
At the moment I get "permission denied (publickey)" when I try to do git commands that access the remote.
(edit) I have set %HOME% to point to my Windows home directory, and there is a .ssh folder in there with id files that work under a gitbash shell.
I appreciate that the answer is likely "no, this is why GitBash exists". But - it would be good to know for sure.
If the answer is "no" it kinda makes you wonder why you would bother putting git on your windows path?
ssh access works fine from a regular DOS session.
You only need to define C:\Users\YourAccount\.ssh
and add your id_rsa
and id_rsa.pub
there.
Launch your git session through git-cmd.bat
, which will define %HOME%
to your C:\Users\YourAccount
: that is what will make ssh work.
This should put your msysgit/bin installation in your PATH.
I really recommend not installing through a msi (Microsoft Installer), but through a simple unzip of an archive (portable version "PortableGit-x.y.z-preview201ymmdd.7z
")
And the OP GreenAsJade's comment points out the fact that GIT_SSH
must point to plink.exe
.
这篇关于在Windows命令提示符下ssh验证git访问?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!