Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7430783
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T09:11:42+00:00 2026-05-29T09:11:42+00:00

How do I download just 2 files from github using command line ? Something

  • 0

How do I download just 2 files from github using command line ?
Something in the lines of :

git fetch git://github.com/username/Project.git/file1
git fetch git://github.com/username/Project.git/file2
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T09:11:43+00:00Added an answer on May 29, 2026 at 9:11 am

    If you go to the page and view the links provided by “raw” (in the top left corner, when viewing the file). You will see, that you can access it by:

    https://github.com/username/repository/raw/$changeset_hash/path/to/file
    

    Instead of $changeset_hash you can also provide a branch (e.g. master) or tag.

    You can retrieve the raw file using something like wget.

    Accessing a single file directly from a .git-repository is not possible (as far as I know), because of how the data is stored.

    edit: When you want to access a file from a private repo, you first have to create an access token with the appropriate permissions in your account settings. Instead of calling the url above you can then use github’s API to access the content of a file. Be sure to use the Accept-header for custom media types to get the raw data. This might look something like this:

    curl \
      -H 'Authorization: token $YOUR_TOKEN' \
      -H 'Accept: application/vnd.github.v3.raw' \
      -O \
      -L 'https://api.github.com/repos/:owner/:repo/contents/:path'
    

    The -O will save the contents in a local file with the same name as the remote file name. For easier use you can wrap it in a script. @Chris_Withers suggested an edit with a nice python snippet that unfortunately got rejected as to big of a change to the answer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When I download something using gem I'd like to be able to just download
I'm trying to install a plugin from the git repo => https://github.com/maccman/acts_as_recommendable . This
I upload and download files from my desktop to a server for work using
I'm trying to download multiple pdf files from a web page (I'm using Mac
Is it possible to force the server to download files from peer-to-peer networks just
I'm using Celerity in JRuby to automate the download of some .csv files from
I'm giving a user a link to download a csv file ...just using Click
I'm using JSch to get files from an SFTP server, but I'm trying to
I am using the Syntax Highlighter built with Javascript by Alex Gorbatchev (http://alexgorbatchev.com/SyntaxHighlighter/download/) The
I have to download some files from an FTP server. Seems prosaic enough. However,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.