GitHub Cookbook: Difference between revisions

From Littledamien Wiki
Jump to navigation Jump to search
Tag: wikieditor
 
Line 38: Line 38:


=== Updating personal access tokens in CLI (Mac OS) ===
=== 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:
Check if a GitHub password is stored in the OSX keychain:

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]