Ruby download_file 来自 https 丢弃 RuntimeError

Ruby download_file from https drops RuntimeError

我在 git https://github.ibm.com/********/buildpack_resource/blob/master/*****.tgz 上有一个文件我想下载(到 Win10)使用以下代码:

download_file(dependency['uri'], local_cached_file)

我收到 C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/buildpack-packager-2.3.4/lib/buildpack/packager/package.rb:126:in `download_file': 失败从 <a href="https://github.com/" rel="nofollow noreferrer">https://github.com/</a>*******/buildpack_01/blob/master/*****.tgz (RuntimeError)

下载文件

我无法 ping 地址,但我可以 ping git.com。 我是 Ruby 的新手。我只是在使用这个 gem,但错误消息看起来很有用。我仍然不明白出了什么问题。

提前致谢!

使用浏览器从 GitHub 门户下载原始文件

如果下载本身令人满意 ?raw=true 到 GitHub 门户上浏览文件的 URL。

或关注:Download single files from GitHub

使用 wget / curl / 其他脚本下载文件

可以,但需要进行授权:How can I download a single raw file from a private github repo using the command line?

克隆存储库

或者实际克隆存储库。要仅获取最新版本,可以使用开关 --depth=1