How to download individual files from GitHub enterprise


Below instructions how to download individual files from private GitHub repository using powershell.


  1. Your GitHub repository is hosted at
  2. Your organisation name is my-org
  3. Your repository name is my-repo
  4. Path to file you are trying to download is /myfiles/file.txt


  1. Obtain personal access token for you account by navigating to your account and choosing settings.
  2. Go to Personal Access Token setting and choose “Generate New Token”. Copy the resulting token key.
  3. Construct URL to the file you are trying to download in following format:
  4. Powershell script to download file is below. Values in italic are variables which will be different in your environment

Invoke-WebRequest -Headers¬†@{“Authorization”=”token 8d795936d2c1b2806587719b9b6456bd16549ad8“;”Accept”= “application/vnd.github.v3.raw”}

If you need to download entire contents of your master branch then request will look like below

Invoke-WebRequest¬†-Headers¬†@{“Authorization”=”token 8d795936d2c1b2806587719b9b6456bd16549ad8“} -OutFile