Retrieve a single file with Git

Jun 26, 2023 · 1 min read · Post a comment

Retrieving a single file from a Git repo it’s not possible …yet. However, there are few workarounds that could get the job done.


  • Git


git archive Download a single file ( in this case) from a remote in current directory:

git archive --remote=[email protected]:foo/bar.git HEAD | tar -x

wget / curl You can always use CLI tools such as wget and curl to download the blob file.

wget <URL> -O testfile
curl <URL>  > testfile


In case you face any issues, feel free to leave a comment below and if you find this tutorial useful, follow our official channel on Telegram.