Home > Mobile >  Change configuration for not change token of private repository
Change configuration for not change token of private repository

Time:11-08

I have a private repository and access of the raw.githubusercontent.com by API is using the ?token=AEDIQE3IPAPDAXI6QPVEBALBSAPEU in the end of the file name. But this token change during the time (10 -15 days) and this is not so good for my purposes. I don't find any way to do not change the token information. Please, this kind of configuration is possible?

CodePudding user response:

Since that token can change, you might consider creating a Personal Access Token (PAT), and downloading the files using the Authorization header instead of a token in the URL.

curl -H "Authorization: token ${PAT}" \
  https://raw.githubusercontent.com/user/repo/main/file.txt

The other approach seen here would be, still with a PAT, to

curl -H "Authorization: token ${PAT}" \
  https://github.com/<username>/<reponame>/raw/<branch>/<path-to-your-file>

This will return a “redirect (HTTP 302)” with location header value pointing to the URL with the token.

You can get the current "raw.githubusercontent.com" token that way.

  • Related