...
Code Block | ||
---|---|---|
| ||
$ 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 | ||
---|---|---|
| ||
$ 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 | ||
---|---|---|
| ||
$ 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 | ||
---|---|---|
| ||
$ 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 | ||
---|---|---|
| ||
$ pass insert github.com/pat Enter password for github.com/pat: <insert your "Personal Access Token", not your GitHub password> |
...
Code Block | ||
---|---|---|
| ||
$ git config --global 'credential.https://github.com.helper' '!f() { test $1 = get && echo password=`pass github.com/pat`; }; f' |
Plain text file (insecure)
...