GitHub Cookbook: Difference between revisions

From Littledamien Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 24: Line 24:
git push -u origin master
git push -u origin master
</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) ===
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>


== See Also ==
== See Also ==

Revision as of 16:43, 1 August 2022


Create a new repo on GitHub

  • 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

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

git remote add origin https://github.com/dbarchowsky/damienjay_web.git
git push -u origin master

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)

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]

See Also