Last time we talked about Use Azure File Share to back up your data, and this time I’m going to share how to use Github as your storage by leveraging the Github content APIs.
Prerequisites
- A Github repository
- A Github token
- Go lang
With the Github contents APIs, you can download a file by using the below shell script.
curl \
-H “Accept: application/vnd.github.v3+json” \
https://api.github.com/repos/Owner/Github-Repo/contents/PATH
The response of the above shell script if PATH is a file
{
“type”: “file”,
“encoding”: “base64”,
“size”: 5362,
“name”: “README.md”,
“path”: “README.md”,
“content”: “encoded content …”,
“sha”: “3d21ec53a331a6f037a91c368710b99387d012c1”,
“url”: “https://api.github.com/repos/octokit/octokit.rb/contents/README.md",
“git_url”: “https://api.github.com/repos/octokit/octokit.rb/git/blobs/3d21ec53a331a6f037a91c368710b99387d012c1",
“html_url”…