GitHub Cookbook: Difference between revisions
No edit summary |
Tag: wikieditor |
||
| (2 intermediate revisions by the same user not shown) | |||
| Line 25: | Line 25: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
== | == Personal access tokens == | ||
=== Accessing and regenerating personal access tokens === | |||
GitHub personal access tokens allow access to a private repo via the command line. Personal access tokens must be regenerated periodically for enhanced security. The default period is 30 days, but something like 90 days is more practical. | |||
Personal access tokens are regenerated on the GitHub website > '''GitHub account dropdown menu''' (at the top right) > '''Settings''' > '''Developer Settings''' (at the very bottom of the menu on the left) > '''Personal Access Tokens''' | |||
The token that has been in use is named "2FA command line." There are others which may or may not be necessary. | |||
Once the token has been regenerated, accessing private repos on the command line will result in authentication errors. | |||
=== Updating personal access tokens in CLI (Mac OS) === | |||
Configure git to use `osxkeychain`: | |||
<syntaxhighlight lang="bash"> | |||
$ git config --global credential.helper osxkeychain | |||
</syntaxhighlight> | |||
Check if a GitHub password is stored in the OSX keychain: | |||
<syntaxhighlight lang="bash"> | |||
$ security find-internet-password -l github.com | |||
</syntaxhighlight> | |||
If the password is managed by the OSX keychain, delete the existing keyword with: | |||
<syntaxhighlight lang="bash"> | |||
$ security delete-internet-password -l github.com | |||
</syntaxhighlight> | |||
After the password is deleted, a prompt for the new password will appear the next time a GitHub password is required. <ref>[https://gist.github.com/jonjack/bf295d4170edeb00e96fb158f9b1ba3c Update an existing token] - GitHub Gist</ref> | |||
== Notes == | |||
=== See Also === | |||
* [[Setting Up a Remote GIT Repository on Windows Server]] | * [[Setting Up a Remote GIT Repository on Windows Server]] | ||
* [[Using Git With Namecheap Web Hosting]] | * [[Using Git With Namecheap Web Hosting]] | ||
=== References === | |||
<references /> | |||
Latest revision as of 19:41, 23 January 2023
Create a new repo on GitHub[edit]
- Sign in
- Top Right > user name > plus sign drop down > Create New... > New Repository
- Enter a name
Create a new local repo from the command line[edit]
touch README.md git init git add README.md git commit -m "first commit" git remote add origin https://github.com/dbarchowsky/damienjay_web.git git push -u origin master
Push an existing repo from the command line[edit]
git remote add origin https://github.com/dbarchowsky/damienjay_web.git git push -u origin master
Personal access tokens[edit]
Accessing and regenerating personal access tokens[edit]
GitHub personal access tokens allow access to a private repo via the command line. Personal access tokens must be regenerated periodically for enhanced security. The default period is 30 days, but something like 90 days is more practical.
Personal access tokens are regenerated on the GitHub website > GitHub account dropdown menu (at the top right) > Settings > Developer Settings (at the very bottom of the menu on the left) > Personal Access Tokens
The token that has been in use is named "2FA command line." There are others which may or may not be necessary.
Once the token has been regenerated, accessing private repos on the command line will result in authentication errors.
Updating personal access tokens in CLI (Mac OS)[edit]
Configure git to use osxkeychain:
$ git config --global credential.helper osxkeychain
Check if a GitHub password is stored in the OSX keychain:
$ security find-internet-password -l github.com
If the password is managed by the OSX keychain, delete the existing keyword with:
$ security delete-internet-password -l github.com
After the password is deleted, a prompt for the new password will appear the next time a GitHub password is required. [1]
Notes[edit]
See Also[edit]
References[edit]
- ↑ Update an existing token - GitHub Gist