GitHub repositories don't support git archive
command, which allows getting content of a single file.
A different method of getting file contents from GitHub is to use GitHub API with an access token, but this requires a different authentication method, and would require creating a special account in an org that could be used for example in CI systems.
I wanted a method that relies on the same auth method as git clone
for example, and still just gets the content of a single file.
Example usage:
./get_github_file.sh facebook react docs/README.md