Search code examples
rubygitbuildpack

Ruby download_file from https drops RuntimeError


I have a file on git https://github.ibm.com/********/buildpack_resource/blob/master/*****.tgz that I want to download (to Win10) with the following code:

download_file(dependency['uri'], local_cached_file)

I receive C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/buildpack-packager-2.3.4/lib/buildpack/packager/package.rb:126:in `download_file': Failed to download file from https://github.com/*******/buildpack_01/blob/master/*****.tgz (RuntimeError)

I can't ping the address, but I can ping git.com. I'm quite new in Ruby. I'm just using this gem, but the error messages looks informative. I still can't understand what goes wrong.

Thx in advance!


Solution

  • Download raw from GitHub portal with browser

    If the download itself is satisfactory ?raw=true to the URL of the browsed file on GitHub portal.

    Or follow: Download single files from GitHub

    Download file with wget / curl / other script

    Is possible, but authorization needs to be carried out: How can I download a single raw file from a private github repo using the command line?

    Clone the repository

    Or actually clone the repository. To get only the last revision, switch --depth=1 may be used.