13

我正在尝试在 OSX 中获得对 curl 的 SFTP 支持。我通过安装了curl

$ brew install curl --with-ssh

我还通过以下方式将自制版本符号链接到 /usr/bin

$ sudo ln -s /usr/local/bin/curl /usr/bin/curl

但我仍然得到

curl: (1) Protocol sftp not supported or disabled in libcurl

使用时

$ curl sftp://some.host.com/path/to/file

我的努力与很棒的 git-ftp 的一个问题有关https://github.com/resmo/git-ftp/issues/146

我究竟做错了什么?

获取问题和答案的更新

4 个回答 正确答案

9

运行“curl -V”并查看 SFTP 是否被列为受支持的协议。

如果不是,curl 需要使用 libssh2 重建以获得内置支持。

  • 6
    你好,谢谢。尽管我使用 ssh 安装了curl,但确实没有列出 sftp。事实证明,自制软件安装了curl /usr/local/Cellar/curl/7.28.0/bin/curl,因此重做符号链接为我完成了它:ln -s /usr/local/Cellar/curl/7.28.0/bin/curl /usr/bin/curl  2012 年 11 月 1 日 21:16
  • 由于同样的错误来到这里,也使用 git-ftp。小世界......仅供参考,Homebrew 在构建curl后说:这个公式是仅桶的,因此它没有符号链接到/ usr / local中。Mac OS X 已经提供了该软件,并行安装另一个版本可能会导致各种麻烦。  2014 年 8 月 7 日 18:46
1

由于该--with-libssh2选项已从brew 中删除,因此可以采用以下方法:

brew install curl-openssl

意识到:

curl is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.

If you need to have curl first in your PATH, run:
  echo 'export PATH="/usr/local/opt/curl/bin:$PATH"' >> ~/.zshrc

或者直接使用以下方式调用:

/usr/local/opt/curl/bin/curl ...
0

现在,您可以Formerly known as: curl-openssl使用以下命令仅安装“curl”:

brew install curl

然后命令例如:

/opt/homebrew/opt/curl/bin/curl -u user:password sftp://sftp.host.com/Export/file.txt

来源https://formulae.brew.sh/formula/curl

-3

如果您使用的是 Mac,则必须先运行此命令才能启用:

brew install curl --with-libssh2

您的答案


来自 https://stackoverflow.com/questions/13171550/sftp-support-for-curl-on-osx