Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WARN Failed to retrieve token from `gh auth token' on every install and it slows down automated installations. #1733

Closed
cocoonkid opened this issue Jun 12, 2024 · 12 comments · Fixed by #1746 or #1769

Comments

@cocoonkid
Copy link

WARN Failed to retrieve token from `gh auth token` err=Os { code: 2, kind: NotFound, message: "No such file or directory" }
 WARN Failed to read git credential file

How can I disable this ? the systems I am using cargo-binstall on do not even have gh installed at all.

Thanks for looking into this.

@NobodyXu
Copy link
Member

You can disable it using --no-discover-github-to

@ryankurte
Copy link
Collaborator

i feel like we could silence this warning unless it discover-github-to or verbose logging is enabled?

github-merge-queue bot pushed a commit that referenced this issue Jun 13, 2024
* Log the gh-auth token retrieval failure on debug level

Fixed #1733

* Make gh_token::get an async function

* Improve returned err msg in gh_token::get

* Update use of gh_token::get() in entry.rs

* Fix typos

* Fix unclosed ()

* Fix unclosed ()

* Fix gh_token.rs

* Fix entry.rs

* Fix fmt in entry.rs

* Fix fmt in gh_token.rs

* Fix fmt in gh_token.rs

* Fix fmt in gh_token.rs

* Fix fmt in entry.rs
@cocoonkid
Copy link
Author

cocoonkid commented Jun 13, 2024

@ryankurte thank you for acting on this in this quick manner.

But only silencing it won't fix the underlying issue. Because in my case for example it stops ansible from executing until it times out.
So imho it should be disabled until explicitly forced? Or is that what was meant with "silencing".

@NobodyXu
Copy link
Member

But only silencing it won't fix the underlying issue. Because in my case for example it stops ansible from executing until it times out. So imho it should be disabled until explicitly forced? Or is that what was meant with "silencing".

Oh you have gh installed using ansible and it is quite slow?

I never encountered such environment, I've already converted the gu-auth-token execution to be async

@NobodyXu NobodyXu reopened this Jun 13, 2024
@NobodyXu
Copy link
Member

@cocoonkid You can disable it using --no-discover-github-to

out of curiosity, how long does it take for for gh auth token to run on your machine?

@alex35mil
Copy link

What about the case when some other binary executes it?
PS The binary in question is cargo-update.

@NobodyXu
Copy link
Member

I can:

  • add an env for that arg
  • make gh-auth-token execute in parallel, until it is actually used

BTW if you explicitly provide a github token via env var GITHUB_TOKEN it would then not use gh-auth-token.

BTW how long does it take for gh auth token to run on your machine?

NobodyXu added a commit that referenced this issue Jun 14, 2024
For #1733

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
@NobodyXu
Copy link
Member

@alex35mil @cocoonkid Opened #1763 for an env var to disable github token scraping.

github-merge-queue bot pushed a commit that referenced this issue Jun 14, 2024
* Add env var BINSTALL_NO_DISCOVER_GITHUB_TOKEN

For #1733

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix fmt

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix fmt

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

---------

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
@NobodyXu
Copy link
Member

NobodyXu commented Jun 15, 2024

Released cargo-binstall 1.7.0

@cocoonkid
Copy link
Author

Apology for the late reply:

I installed gh on the hosts as well but this did not help. (which is kinda weird?)

The timeout in my case happened around the 30sec mark.

Will try out the ENV var soon! thanks so much for the quick fix!

@cocoonkid
Copy link
Author

Just confirming: the env variable solved the isssue as expected. Many many thanks!

@NobodyXu
Copy link
Member

I installed gh on the hosts as well but this did not help. (which is kinda weird?)

I think it's because of the order in PATH?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants