I wrote a series of Bash scripts. They make my work on Google Cloud Platform (GCP) easier.
Since the PORT 25 for mail service is strictly blocked by GCP, and at the same time, building mail service on my own is quite complex. So, under Google's Suggestion, I decided to use SendGrid.
SendGrid utilizes a bot called GitGuardian to scan public repositories on GitHub, and would temporarily suspend your account if you accidentally pasted SendGrid's API key in it.
So, better save the API key in private repositories.
To download a file from private repository
1. You need to generate a Personal Access Tokens.
According to this GitHub help page:
- In the upper-right corner of any page, click your profile photo, then click Settings.
- In the left sidebar, click Developer settings.
- In the left sidebar, click Personal access tokens.
- Select the scopes. To use your token to access repositories from the command line, select repo.
- Click Generate new token.
- Give your token a descriptive name.
Let's suppose your actual token is 1234567abcdefg
2. Embed Token into the link.
- Open the file in GitHub web page and click "Raw"
Copy the link of this raw file, maybe something like this:
https:// raw.githubusercontent.com/GITHUB_ACCOUNT/REPOSITORY_NAME/BRANCH_NAME/FILE_NAME.EXTENTION_NAME?token=SOME_NUMBERS_LETTERSReform the link as
https:// 1234567abcdefg@raw.githubusercontent.com/GITHUB_ACCOUNT/REPOSITORY_NAME/BRANCH_NAME/FILE_NAME.EXTENTION_NAME
As you see, "?token=SOME_NUMBERS_LETTERS" are removed. Insert the token you generated from GitHub + @ right after "https://"
To use the link
curl -s -O https://1234567abcdefg@raw.githubusercontent.com/GITHUB_ACCOUNT/REPOSITORY_NAME/BRANCH_NAME/FILE_NAME.EXTENTION_NAME
Hope this would help! Cheers! 🍻
Top comments (5)
Hi, is this still working? I've just tried with no success
Worked for me in Mar 2021
yes it works, just what I was looking for
Doesnt work anymore. July 2023 error 404
Some comments may only be visible to logged-in visitors. Sign in to view all comments.