shurcooL/Go-Package-Store

Document GO_PACKAGE_STORE_GITHUB_TOKEN env var to provide a GitHub token (for higher rate limit, private repos).

hgfischer opened this issue · 3 comments

Hello @shurcooL

I have a github.token set in my ~/.gitconfig that works fine with https://github.com/tcnksm/ghr for example, but I could not find a way to do this with Go-Package-Store.

I also have some private git repositories that Go-Package-Store cannot scan.

Hi @hgfischer,

Thanks for asking. It's possible to provide a GitHub token for Go Package Store to use by setting the GO_PACKAGE_STORE_GITHUB_TOKEN environment variable. (You can see it in code here.)

It tells you that in the error message if you happen to exceed the unauthenticated GitHub API rate limit (see it in code here). But perhaps it'd be even better if I also mentioned this in the usage text and in README. I'll use this issue to track that.

Thanks for the help. Yes, would be nice to have this documented.

Wouldn't it be interesting to also add support for the same configuration from .gitconfig?

This can easily be done with the package github.com/tcnksm/go-gitconfig which is the same ghr uses.

For example: tcnksm/ghr@06a0e59

Supporting additional ways to provide the github access token, such as via .gitconfig is something we can consider. I plan to use this issue to track documenting GO_PACKAGE_STORE_GITHUB_TOKEN env var only. If you want the .gitconfig feature, please file that in a separate issue.