Windows 上的 Git bash - 不支持 sftp

标签 git bash sftp msysgit

我想使用 GIT Bash 在服务器上上传文件。我正在使用适用于 Windows 的 msysgit。

FTP 上传正常,但 sftp 不工作。

git ftp init --verbose

给我错误:libcurl 不支持或禁用 sftp

我试图使用此引用将 libssh2 安装到 Cygwin http://docs.oracle.com/cd/E24628_01/install.121/e22624/preinstall_req_cygwin_ssh.htm#EMBSC150

但是还是出现了错误。我不知道我是否必须直接安装一些东西到 GIT Bash 或者我还能做什么?

感谢您的任何建议。


编辑:我更新了 msysgit 和其他软件,现在我只是不知道如何从服务器获取证书。从 WinSCP 我只使用接受指纹,仅此而已。

curl -v --insecure sftp://user:password@xxx.com

  • 可用的SSH认证方式:publickey,password
  • 使用 SSH 公钥文件“(nil)”
  • 使用 SSH 私钥文件 'C:\Users\xxx/.ssh/id_rsa'
  • SSH 公钥认证失败:用户名/公钥组合无效

curl :(67)身份验证失败

我在这里看到https://github.com/git-ftp/git-ftp/issues/124我可以使用另一个 key 而不是我的默认 key 。但我不知道如何从服务器获取该 key 。

最佳答案

确保您没有将 git 与 Cygwin 或 old and obsolete msysgit 1.9.x version 一起使用.

随着new git for windows, 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

是的,不需要 ssl certificate with sftp , 只需让 'C:\Users\xxx/.ssh/id_rsa(.pub)'

中没有 key

From WinSCP I use only accept fingerprint and that was it.

这可能是问题所在:known_host 必须具有远程服务器指纹。参见 for instance my script或这篇博文:

To get a look at the server’s public key fingerprint before attempting a connection, one can utilize the ssh-keyscan program

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 named tmp, then the file is checked with the ssh-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.

关于Windows 上的 Git bash - 不支持 sftp,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33165328/

相关文章:

git - 如何使用 wget 在 unix 上安装 git?

git - 为什么在使用 cygwin 时 git svn clone 失败?

linux - 在 bash 脚本和 awk 命令方面需要帮助

arrays - 在 Bash 中将以空格分隔的字符串读入数组

docker - 使用 SFTP 从本地机器上的 Sublime Text 编辑 Docker 容器 ("remote"中的文件

git - 在使用 Git 或 SSH 复制/远程登录等时,我们应该重复使用相同的 SSH key 还是每次都创建新 key ?

git - 在 Gitkraken diff 窗口中显示整个文件

mysql - Shell 脚本权限被拒绝 mysqldump : Got errno 32 on write only in Cron

linux - 使用 wget 和 SFTP 获取文件

java - 为 Java 客户端设置 SFTP 服务器以仅允许使用公钥下载