gitfetch icon indicating copy to clipboard operation
gitfetch copied to clipboard

Not detecting Github Authentication

Open Chinychon opened this issue 1 year ago • 8 comments

OS: Ubuntu 24.04.3 LTS x86_64 Installed with pipx install git+https://github.com/Matars/gitfetch

❯ gh auth status
github.com
  ✓ Logged in to github.com account Chinychon (keyring)
  - Active account: true
  - Git operations protocol: https
  - Token: gho_************************************
  - Token scopes: 'gist', 'read:org', 'repo', 'workflow'

❯ gitfetch
🚀 Welcome to gitfetch! Let's set up your configuration.
Choose your git provider:

● GitHub
○ GitLab
○ Gitea/Forgejo/Codeberg
○ Sourcehut

Use ↑/↓ arrows, ● = selected, Enter to confirm

Could not get authenticated user: Failed to get auth status
Please authenticate with: gh auth login
Error: Initialization failed

Chinychon avatar Oct 21 '25 03:10 Chinychon

Could you let me know if this is still happening on latest release (v1.1.7)

https://github.com/Matars/gitfetch/releases/tag/v1.1.7

Matars avatar Oct 21 '25 03:10 Matars

Same here. I checked out main and v1.1.7, same issue. Even gh auth login challenge succeeded and gh status is fine gitfetch complains it could not get authenticated user.

kyoshiro avatar Oct 21 '25 06:10 kyoshiro

Yes I am on the latest version. It works when I manually configure the [DEFAULT] section in gitfetch.conf

Chinychon avatar Oct 21 '25 06:10 Chinychon

As @Chinychon mentioned, configuring manually the authentication works. So I missed the provider settings, because this wasn't differentiated before. But, I also moved the config file to let gitfetch create a fresh one and this didn't work out. The config file has not been created again.

kyoshiro avatar Oct 21 '25 06:10 kyoshiro

Happens for me too looks like gh auth status --json hosts (the command used to find authenticated user) does not exist for me, triggering the error.

We could maybe try loading the ~/.config/gh/hosts.yml and find it that way? Or use my previously proposed fix to use regex on gh auth status if everything else fails

Zeviraty avatar Oct 21 '25 09:10 Zeviraty

Need to figure out though if ~/.config/gh/hosts.yml exists on every platform

Zeviraty avatar Oct 21 '25 09:10 Zeviraty

Made pull request to add simple fix #25

Zeviraty avatar Oct 21 '25 09:10 Zeviraty

Happy waking up to this, thank you

Matars avatar Oct 21 '25 09:10 Matars