Reputation: 10476
I want to be able to download the latest version of an xml file containing data that exists in my github repository. However, the token at the end of the file changes when I commit a new version of the file.
Is there a way to prevent the token from changing or somehow find out what it is programmatically?
I need a permanent link I can access...
Upvotes: 11
Views: 9061
Reputation: 814
The token in the URL has nothing to do with the file, it's an authentication token that is needed to download the raw file from a private repo. It doesn't change when you commit a new file, it changes when your Oauth session expires and you login again. To get one that doesn't change, just make a Personal Access Token (https://github.com/settings/tokens) and replace the token in the URL with that.
Upvotes: 3
Reputation: 1327314
You should be able to use raw.githubusercontent.com and curl that file:
Example: https://raw.githubusercontent.com/git/git/master/README.md
That will be default give you the latest of the master branch.
That same URL is listed in GitHub API repository Content.
Upvotes: 0