Skip to content

A guide to installing files from GitHub repos in terminal using cURL

Notifications You must be signed in to change notification settings

minsungson/GitHub-cURL

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Download Files from GitHub using cURL

From Public Repos

  1. Head to the repo where the file you want to download is located, click on the file, then 'raw'. Take note of the URL and file name with extention.
  2. Execute the following command in terminal
curl -O FILE_NAME.EXTENTION https://raw.githubusercontent.com/GITHUB_USERNAME/REPOS/BRANCH/FILE_NAME.EXTENTION
  1. The file should now be downloaded and saved to your home directory.
  2. To run the file, execute:
/usr/local/bin/python3 FILE_LOCATION

From Private Repos

  1. Head to the repo where the file you want to download is located, click on the file, then 'raw'. Take note of the URL in the format https://raw.githubusercontent.com/GITHUB_USERNAME/REPOS/BRANCH/FILE_NAME.EXTENTION?token=STRING_OF_LETTERS_AND_NUMBERS

  2. Then go to GitHub settings > Developer settings > Personal access tokens > Generate new token. Make sure to give it a memorable note and to tick 'Full control of private repositories'. alt text

  3. Suppose the token is abcd1234; rearrange the URL so it follows the form: https://abcd1234@raw.githubusercontent.com/GITHUB_USERNAME/REPOS/BRANCH/FILE_NAME.EXTENTION. Observe that '?token=STRING_OF_LETTERS_AND_NUMBERS' has been removed, and the token has been placed in front of the URL, followed by an @.

  4. Now that you have a URL in the form cURL recognises, excecute it with the command:

curl -O https://abcd1234@raw.githubusercontent.com/GITHUB_USERNAME/REPOS/BRANCH/FILE_NAME.EXTENTION
  1. The file should now be downloaded and saved to your home directory.
  2. To run the file, execute:
/usr/local/bin/python3 FILE_LOCATION

Basic Options that can be used

Option Description
-o Write output to file instead of stdout
-O Write output to a local file named like the remote file we get
-s Silent or quiet mode. Do not show progress meter or error messages
-v Download using verbose mode
-# Hashtag progress bar

About

A guide to installing files from GitHub repos in terminal using cURL

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published