How can I checkout or download single file from GitHub repo

Hello Everyone,

I am new to GitHub.

We have requirement in our organization where we need to checkout single file (not branch) from GitHub repo and move to target server but I couldn’t see any option to checkout single file.

Can you please suggest if we have any such option and how to do it.




There’s not really a way to do this without git cloneing your entire repo.

If it’s just a single file, you can go to your GitHub repo, find the file in question, click on it, and then click “View Raw”, “Download” or similar to obtain a raw/downloaded copy of the file and then manually transfer it to your target server.

​If there’s anything else I can help you with, let me know; so happy to help further!

Kindest regards,


_ Why you lie? _

Example: Download from master branch on remote repo

git checkout origin/master --

That still requires the repo via clone before you can just checkout individual files.

Probably the easiest way is use wget to pull down the raw file:


Thanks! this was what I was looking for

1 Like

Hi ! how can I remove the read only file, in a class ? because I can’t edit the code. Thank you in advance

Might be a noob answer but try to download the files to google colab and move it using shutil.copytree to your Google Drive! Then download the files / subfolders you have and delete the whole thing from your Drive! 

P.S. - Might seem really long but nothing doing if you’re dealing with deep learning trained weights( My file size was around 250mb) so had to do it! :slight_smile:

In case the above steps are not clear , open this notebook on google colab! 

Link to the notebook 

Nah, download as Winzip