Setup git client for https access to github using token
I needed to connect to company’s github.com domain access with organizations SSO. Some of local script refers to the github.com space with https access which requires configuration for token setup by github CLI.
Add remote URL (if applicable)
For accessing to new remote address, you may add remote url by git remote add
command.
|
|
Ref. Github Docs | Managing remote repositories
Generating a personal access token
Github > settings > Developer settings > personal access tokens
On GUI, Give your descriptive name, Expiration, select permission, and click “Generate Token”.
After creating token, you can use the token as a password that is required by prompt.
|
|
Ref. Github Docs | Creating a personal access token
Caching github credential in git
-
Configure by
gh auth login
|
|
Ref. Github Docs | Caching your GitHub credentials in Git
Re-authorize github application
Sometime, github requires re-authorized application during process for accessing over https.
To re-authorize, you can go to your settings on GitHub -> Applications -> Authorized OAuth Apps, find “GitHub for VSCode”, and choose “Revoke” from the “…” menu. If you then sign out in VSCode and sign in again, you should be prompted to re-authorized