Access via fine grained access token

If you want to push to github, you first have to create an access token. Preferably create a fine-grained access token (https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-fine-grained-personal-access-token) as general personal access tokens are a security risk. Then when you want to push e. g. like this

git push -u origin main

you will be asked to provide a username and a password. As username type in your github user name and instead of your github password you enter the fine grained access token.

Access via ssh key

Create an ssh key, add to your github account and to your ssh agent via ssh-add <Your Key>

Use github on a remote computer

There is a difference between being locally graphically logged in and accessing a computer from the outside. For some reason the latter does not access the ssh agent properly, so you have to fix this

git config --local credential.helper cache
eval `ssh-agent` 
ssh-add <YOUR KEY> 
Log In