Skip to content

Instantly share code, notes, and snippets.

@philip-gai
Created February 7, 2022 22:14
Show Gist options
  • Save philip-gai/8b9b03446bed634413a0fd86045fbdd2 to your computer and use it in GitHub Desktop.
Save philip-gai/8b9b03446bed634413a0fd86045fbdd2 to your computer and use it in GitHub Desktop.
Update GITHUB_TOKEN in Codespace to work for multiple repositories
# You have to unset the GITHUB_TOKEN, otherwise gh cli will use it and skip auth
unset GITHUB_TOKEN
# List of scopes: https://docs.github.com/en/developers/apps/building-oauth-apps/scopes-for-oauth-apps#available-scopes
gh auth login --hostname 'github.com' --scopes 'read:org,repo,read:packages'
token="$(gh config get -h github.com oauth_token)"
export GITHUB_TOKEN="$token"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment