Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagebash
$ echo '<PAT>' | gpg --symmetric --output ~/github-pat.gpg
Enter passphrase:
Repeat passphrase:

Finally you must configure Git to decrypt and read the personal access from the file ~/github-pat.gpg when credentials are needed for https://github.com. This is done by the following command:

Code Block
languagebash
$ git config --global 'credential.https://github.com.helper' '!f() { test $1 = get && echo password=`gpg --decrypt ~/github-pat.gpg`; }; f'

age

You can use age to store your personal access token encrypted in a file. You will first have to store your GitHub username in the Git configuration file by running the following command (replace <USERNAME> with your GitHub username):

...

Code Block
languagebash
$ echo '<PAT>' | age --passphrase > ~/github-pat.age 

Finally you must configure Git to decrypt and read the personal access token from the file ~/github-pat.age when credentials are needed for https://github.com. This is done by the following command:

Code Block
languagebash
$ git config --global 'credential.https://github.com.helper' '!f() { test $1 = get && echo password=`age --decrypt ~/github-pat.age`; }; f'

pass

You can use pass to store your personal access token encrypted in a file. You will first have to store your GitHub username in the Git configuration file by running the following command (replace <USERNAME> with your GitHub username):

...

Code Block
languagebash
$ pass insert github.com/pat
Enter password for github.com/pat: <insert your "Personal Access Token", not your GitHub password>

...

Code Block
languagebash
$ git config --global 'credential.https://github.com.helper' '!f() { test $1 = get && echo password=`pass github.com/pat`; }; f'

Plain text file (insecure)

...