Created
May 14, 2022 17:32
Star
You must be signed in to star a gist
One-liner for downloading from a private GitHub repository
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Fill these in with your own values | |
$Username = "your_username" | |
$Branch = "main" | |
$PathToFile = "README.md" | |
# Go to [https://github.com/settings/tokens] and add a Personal Access Token with two scopes: "repo" and "read:org" | |
$GitHubAuthToken = "ghp_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" | |
Invoke-WebRequest -Method Get -Uri "https://raw.githubusercontent.com/$Username/$Repository/$Branch/$PathToFile" -Headers @{Authorization="token $GitHubAuthToken"; 'Cache-Control'='no-cache'} | ForEach-Object { $_.Content } | Write-Host |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment