Windows 上的 Git bash - 不支持 sftp
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/33165328/
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
Git bash on Windows - sftp not supported
提问by Manic Depression
I would like to use GIT Bash to upload files on server. I am using msysgit for Windows.
我想使用 GIT Bash 在服务器上上传文件。我在 Windows 上使用 msysgit。
FTP upload is ok, but sftp not working.
FTP 上传没问题,但 sftp 不工作。
git ftp init --verbose
git ftp init --verbose
gives me error: sftp not supported or disabled in libcurl
给我错误:libcurl 中不支持或禁用 sftp
I was trying to install libssh2 to Cygwin with this reference http://docs.oracle.com/cd/E24628_01/install.121/e22624/preinstall_req_cygwin_ssh.htm#EMBSC150
我试图使用此参考将 libssh2 安装到 Cygwin http://docs.oracle.com/cd/E24628_01/install.121/e22624/preinstall_req_cygwin_ssh.htm#EMBSC150
But error still ocured. I don't know if I must install something directly to GIT Bash or what can I do else?
但错误仍然发生。我不知道我是否必须直接在 GIT Bash 上安装一些东西,或者我还能做什么?
Thank you for any advices.
感谢您的任何建议。
Edit: I updated msysgit and other software, now I just don't know how to get certificate from the server. From WinSCP I use only accept fingerprint and that was it.
编辑:我更新了 msysgit 和其他软件,现在我只是不知道如何从服务器获取证书。从 WinSCP 我只使用接受指纹,就是这样。
curl -v --insecure sftp://user:[email protected]
curl -v --insecure sftp://user:[email protected]
- SSH authentication methods available: publickey,password
- Using SSH public key file '(nil)'
- Using SSH private key file 'C:\Users\xxx/.ssh/id_rsa'
- SSH public key authentication failed: Username/PublicKey combination invalid
- 可用的SSH认证方式:publickey,password
- 使用 SSH 公钥文件 '(nil)'
- 使用 SSH 私钥文件 'C:\Users\xxx/.ssh/id_rsa'
- SSH 公钥认证失败:用户名/公钥组合无效
curl: (67) Authentication failure
curl: (67) 认证失败
I saw here https://github.com/git-ftp/git-ftp/issues/124that I can use another key instead of my default. But I don't know how to get that key from server.
我在这里看到https://github.com/git-ftp/git-ftp/issues/124我可以使用另一个密钥而不是我的默认密钥。但我不知道如何从服务器获取该密钥。
回答by VonC
Make sure you are not using git with Cygwin or the old and obsolete msysgit 1.9.x version.
确保您没有将 git 与 Cygwin 或旧的和过时的 msysgit 1.9.x 版本一起使用。
With the new git for windows,sftp
should be supported:
对于 windows的新 git,sftp
应该支持:
C:\Users\vonc\prog\seec>c:\prgs\git\PortableGit-2.6.1-64-bit\usr\bin\curl.exe -V
curl 7.44.0 (x86_64-pc-msys) libcurl/7.44.0 OpenSSL/1.0.2d zlib/1.2.8 libidn/1.32 libssh2/1.6.0
Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: Debug IDN IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP UnixSockets Metalink
This project which needs sftp requires only user and password without any certificate file
这个需要sftp的项目只需要用户名和密码,不需要任何证书文件
True, no need for an ssl certificate with sftp, simply make there is no key in 'C:\Users\xxx/.ssh/id_rsa(.pub)
'
是的,不需要带有 sftp的ssl 证书,只需使 ' C:\Users\xxx/.ssh/id_rsa(.pub)
' 中没有密钥
From WinSCP I use only accept fingerprint and that was it.
从 WinSCP 我只使用接受指纹,就是这样。
That could be the issue: the known_host
must have the remote server fingerprint. See for instance my scriptor this blog post:
这可能是问题所在:known_host
必须具有远程服务器指纹。例如,请参阅我的脚本或这篇博文:
To get a look at the server's public key fingerprint before attempting a connection, one can utilize the
ssh-keyscan
program
要在尝试连接之前查看服务器的公钥指纹,可以使用该
ssh-keyscan
程序
ssh-keyscan -t ecdsa host.example.org > tmp
ssh-keygen -lf tmp
256 03:ed:6d:1f:ff:56:9d:5f:f3:65:20:b5:ad:55:55:87 host.example.org (ECDSA)
Here the
-t
is for type of key to be scanned (which can be rsa1 for protocol version 1, dsa, ecdsa, ed25519, or rsa for protocol version 2).
The output is redirected to a temporary file namedtmp
, then the file is checked with thessh-keygen
program.Once client has verified the fingerprint, it will store a copy of the server's public key in
$HOME/.ssh/known_hosts
and will check the stored key on subsequent connections to that host.
If the server has changed its keys, or another machine is attempting to spoof the real server, the client will notice and will not allow connections to that host.
这
-t
是要扫描的密钥类型(对于协议版本 1,可以是 rsa1,对于协议版本 1,可以是 rsa,ecdsa,ed25519,对于协议版本 2,可以是 rsa)。
输出被重定向到一个名为 的临时文件tmp
,然后用ssh-keygen
程序检查该文件。一旦客户端验证了指纹,它将在其中存储服务器公钥的副本,
$HOME/.ssh/known_hosts
并在后续连接到该主机时检查存储的密钥。
如果服务器更改了它的密钥,或者另一台机器试图欺骗真实服务器,客户端会注意到并且不允许连接到该主机。
回答by Anantha Raju C
Official GitHub link for the Issue.
官方GitHub的链接的问题。
Procedure to Add Sftp-capabilities to cURLin Linux(Ubuntu)
在 Linux(Ubuntu) 中将Sftp 功能添加到 cURL 的过程