Use of tokens#
To authenticate with GitHub, you need to generate a personal access token. Username and password will not work.
I followed instructions here: https://www.squash.io/how-to-authenticate-git-push-with-github-using-a-token/
On GitHub.com
Login and click your profile in the top right, then select “Settings”
Scroll down on the left side bar and click “Developer settings” and select “Personal access tokens (classic)”
Click on the “Generate new token (classic)” button.
Give it a descriptive name (I put my name and the repository I’m using it for in the name, e.g., “eleanorfrajka-seaocn”). But note that the token is not repository-specific.
Select the desired scopes: For git operations you need to select the “repo” and “workflow” scope.
Click on the “Generate token” button at the bottom of the page.
GitHub will generate a token and show it to you once. Copy this token and put it somewhere useful but not in your github repository. This is like a password, and you don’t want to share your password. If for some reason you want to keep it in your repository, then add it only on your local computer e.g. in a filename like “token.txt” and immediately add that filename to your “.gitignore” file. But generally, do not put it in your repository.
Note
Do not put this token anywhere within your git repository!
On your local computer
Open a terminal window or command prompt
Set the token as a credential helper by running the following command, replacing
<TOKEN>
with your generated token,git config --global credential.helper '!f() { sleep 1; echo "username=<USER>:token=<TOKEN>"; }; f' git remote set-url origin https://<USER>:<TOKEN>@github.com/ifmeo-hamburg/messfern
See also
Authentication for git push with token https://www.squash.io/how-to-authenticate-git-push-with-github-using-a-token/