0

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!

torek
  • 448,244
  • 59
  • 642
  • 775
Andr
  • 88
  • 1
  • 10
  • Can you locate the file directly on https://github.ibm.com? Can you download it from there? Notice that the "View Raw" link appends `?raw=true` to URL – petrpulc Jun 28 '18 at 12:01
  • hi @petrpulc I can navigate on github to the file. I can step in it as it is a tgz, so its a zipped folder. I used the url that I copied when I stpped in into the tgz... . Not sure how I can download a file from a git. I can get the link of the .git itself.. and I can download the .git too. It's a private git. – Andr Jun 28 '18 at 12:04
  • Can you navigate browser to https://github.ibm.com/********/buildpack_resource/blob/master/*****.tgz?raw=true ? Does this result in download? Or do you need to download the file form ruby script? – petrpulc Jun 28 '18 at 12:07
  • thx @petrpulc! I can copy out this link open in a new browser. I get a github screen where I see my file. And now I also see a download button. When I press it I see the raw.. thing you mentioned: http://raw.githubusercontent.com appears in the windows opern or save popup window... – Andr Jun 28 '18 at 12:09
  • Will add an answer for future reference. – petrpulc Jun 28 '18 at 12:11

1 Answers1

1

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.

petrpulc
  • 940
  • 6
  • 22
  • trying hard.. but not working yet :( I'm using the answer I found under your link to "Download file with wget/curl/other script. First I try to create some soert of https://api.github.com/repos/.... url – Andr Jun 28 '18 at 13:17
  • maybe I need a token set up on github? – Andr Jun 28 '18 at 13:20
  • But beware, you need to use URL of your company github. – petrpulc Jun 28 '18 at 13:20
  • 1
    Yes, you need a token, but not on github.com, but on github.ibm.com (Maybe ask your IT how to obtain it and use it ;) ) – petrpulc Jun 28 '18 at 13:21