Skip to content

Refresh gh login from the Git credential store - #40

Open
akan72 wants to merge 2 commits into
mainfrom
akan72/gh-auth-refresh
Open

Refresh gh login from the Git credential store#40
akan72 wants to merge 2 commits into
mainfrom
akan72/gh-auth-refresh

Conversation

@akan72

@akan72 akan72 commented Aug 27, 2026

Copy link
Copy Markdown
Owner

Summary

gh's stored login can expire independently of the Git PATs, leaving git push working while gh API calls 401. This documents the fix and wires it in: gh config lives in the gitignored gh/ directory, GH_CONFIG_DIR is exported in bashrc so every shell (including non-interactive agent shells) resolves the same login, and scripts/gh-auth-refresh.sh re-feeds the PAT from a Git credential store into gh auth login --with-token without displaying it.

Test Plan

  • sh scripts/gh-auth-refresh.sh — prints "Logged in to github.com account akan72"
  • Open a new shell: echo $GH_CONFIG_DIR — prints /Users/ak/dotfiles/gh
  • gh api user --jq .login — prints akan72

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant