💻
Cheatsheets
  • Most Useful Command Line Tools: 50 Cool Tools to Improve Your Workflow, Boost Productivity, and More
  • 7_tips_to_reverse_engineer_javascript
  • Configuring a Repl
  • How to create your command-line program (CLI) with NodeJS and Commander.js | by Duc N. | JavaScript
  • replit Node.JS 24/7 Project Hoster
  • cheatsheets
  • Alacritty, Tmux, and Vim
  • amethyst
  • Android
  • Installing Arch Linux
  • Arch Linux
  • aria2
  • bin
  • bspwm
  • Chocolately Notes
  • command_line_pipes
  • CSS Grid
  • curl
  • The curl guide to HTTP requests
  • Docker
  • Easymotion
  • Emmet
  • Favorite figlet fonts
  • FFMPEG
  • figlet
  • File Serve
  • File Transfer
  • fish shell
  • Front End Dev Links
  • How to use Git.io to shorten GitHub URLs and create vanity URLs
  • Git
  • Downloading a Tarball from GitHub
  • Make Infinite Gmail Addresses For One Inbox
  • How To Use GPG on the Command Line
  • guide_to_fish_completions
  • Homebrew
  • How to clean Arch Linux
  • HTML5 Boilerplate
  • Install
  • All the keyboard shortcuts you’ll ever need for Safari on iPad
  • iosevka
  • iPhone
  • ish (iOS)
  • Javascript Notes
  • jq
  • Jupyter Notebooks
  • Lettering
  • lf-wiki
  • lf
  • Command Line
  • Adding a swapfile after a clean installation without swap partition
  • mac_bluetooth_issues
  • Mac Terminal
  • maim
  • markdown-sample
  • Markdown Notes
  • Images in README.md Markdown Files
  • Organizing information with tables
  • md_cheatsheet
  • NiftyWindows Help
  • nix
  • Justin Restivo - A Portable Text Editor: Nix <3 Neovim
  • NPM
  • neovim configuration
  • Pastery
  • Powershell
  • Table of Basic PowerShell Commands | Scripting Blog
  • Powershell Modules
  • Puppeteer
  • Python
  • rclone-colab
  • replit
  • Hi there, I'm Raju Ghorai - a.k.a. [coderj001]
  • Scriptable
  • Servor
  • Replacing Postlight’s Mercury scraping service with your self-hosted copy
  • Shell Scripts
  • skhd
  • Spicetify
  • SSH
  • SurfingKeys
  • tar
  • Terminal Web Browser Docker
  • Text Generators
  • tmux shortcuts & cheatsheet
  • unicode
  • VIM
  • VIM Diff
  • vi Complete Key Binding List
  • 8 Essential Vim Editor Navigation Fundamentals
  • Vim Shortcut Keys
  • Vite
  • VNC
  • web-servers
  • Web Server
  • Windows Command Line
  • Writeguard
  • WSL Cheatsheet
  • youtube-dl
  • zsh Plugins
  • zspotify
Powered by GitBook
On this page
  • 1. Overview
  • 2. Using curl Command
  • 3. Using wget Command
  • 4. Downloading From Private Repositories

Was this helpful?

Downloading a Tarball from GitHub

PreviousGitNextMake Infinite Gmail Addresses For One Inbox

Last updated 1 year ago

Was this helpful?

1. Overview

GitHub allows us to fetch a repository in two ways:

  1. Using git clone

  2. Download as a zip or tarfile

Although git clone is the most used method, it requires a Git installation on the machine. If Git is not available, we can in tar format and unpack the contents on the file system.

In this tutorial, we'll look at some Linux commands to download the GitHub repository tarball and unpack it on the file system.

2. Using curl Command

We can access any HTTP URL by using the [curl](/curl-rest) command. And since GitHub allows us to download the repository archive over HTTP, we can download this tarball using curl:

curl -L  https://github.com/Baeldung/kotlin-tutorials/tarball/master -o dummy.tgz

We used the -L flag to allow curl to follow redirects. This is necessary because GitHub redirects all download requests to an . If we skip this flag, we'll get a 302 HTTP status code with redirect headers.

The above command will download the .tgz file to the same location where the curl command was executed. Later, we can unpack this file by using the [tar](/linux/tar-command) command.

We can also unpack inline:

curl -L https://github.com/Baeldung/kotlin-tutorials/tarball/master | tar -xz

In most cases, curl can handshake the HTTPS connection with GitHub. However, if this connection fails, we can use the insecure option in **curl**:

curl -L -k https://github.com/Baeldung/kotlin-tutorials/tarball/master | tar -xz

3. Using wget Command

Apart from the curl command, which is a general-purpose command to execute HTTP requests, Linux also provides a [wget](/linux/curl-wget) command which is a dedicated non-interactive network downloader.

It supports HTTP and FTP protocols and thus can also be used to download repository archives from GitHub:

wget https://github.com/Baeldung/kotlin-tutorials/tarball/master -O dummy.tgz

Likewise, the above command will download the .tgz file to the same location where the command is executed.

Similar to the curlcommand, we can unpack the archive file inline:

wget https://github.com/Baeldung/kotlin-tutorials/tarball/master -O - | tar -xz

The command -O option redirects the archive content to the standard output and acts as an input to the tar command.

Again, similar to the curl command, we can skip the HTTPS certificate verification in **wget using** –no-check-certificate :

wget --no-check-certificate https://github.com/Baeldung/kotlin-tutorials/tarball/master -O - | tar -xz

4. Downloading From Private Repositories

The commands we have discussed so far are useful for downloading archives from a public repo. However, in the case of a private repository, we need to provide GitHub access tokens:

curl -L -k -u token:x-oauth-basic https://github.com/Baeldung/kotlin-tutorials/tarball/master | tar -xz

Here, the token is an alphanumeric OAuth token which we need to add to the GitHub account.

download the repository
archive location