Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do GitHub raw urls expire?

Tags:

github

Do GitHub raw urls for private repositories expire? I'm referring to the link generated when you click the Raw button while viewing a file on github.com.

The link includes a token but there's no info about where that token comes from.

like image 641
user4722818 Avatar asked Sep 01 '25 21:09

user4722818


2 Answers

No one has clearly mentioned this, but the github raw urls expire in 7 days.

You can use longer lasting personal access tokens generated here: https://github.com/settings/tokens but those can only be used via curl:

curl -H 'Authorization: token <personal_token>' <raw_url>

Note that the personal access tokens expire if unused for an entire year.

like image 142
rouble Avatar answered Sep 04 '25 07:09

rouble


That token comes from using OAuth with Git

https://<oauth-secret>:[email protected]/<me>/<repo>/master/<file>

The raw.githubusercontent.com/<me>/<repo>/master/<file> part does not expire.
But it is to type 'y' before clicking 'Raw' on the GitHub page, in order to get the SHA1 as part of the url: that way, you are sure to reference always the same file version.

https://<oauth-secret>:[email protected]/<me>/<repo>/<sha1>/<file>
                              ^                                             ^^^^

The token part does not "expire" (but it can be deleted or revoked)

like image 26
VonC Avatar answered Sep 04 '25 08:09

VonC