0

Gihub removed password authentication:

remote: Please see https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ for more information.
fatal: unable to access 'https://github.com/.../.....git/': The requested URL returned error: 403

So how are we practically supposed to use tokens? I for one cannot remember the token, so now I have a textfile with the token stored in plain text on my desktop, that I paste into WSL linux when pushing. This is less secure now that I have to have the password easily accessible.

1
  • But if someone steals it they can only do the stuff the token lets them do.
    – user253751
    Aug 19, 2021 at 14:26

1 Answer 1

4

Standard git operations (push, pull, delete branch...) can be done using public key authentication. This is a more secure and convenient way to authenticate to GitHub (Just make sure that no one has access to your private key file).

To add your public key to your GitHub account go to Settings > SSH and GPG keys

If you need to use an API Token (e.g. you're using the gh command line utility), you can set the GITHUB_TOKEN environment variable in your bash profile ($HOME/bash_profile or $HOME/.bashrc if you're using bash as your shell). https://cli.github.com/manual/

2
  • Have you tried setting up handling SSH keys in linux in a secure and convenient way for github. What a pain, people making their own key ring scripts, needing to start and share agents between shells, its not trivial. Aug 18, 2021 at 19:44
  • 3
    I think you're mixing up setting up GPG keys with SSH keys. Setting up SSH keys is pretty simple. First determine if you already have an ssh key (Check if the id_rsa and id_rsa.pub files exist in $HOME/.ssh). If they already exist then just copy the contents of id_rsa.pub into the GitHub page I linked to. If they don't exist then just run ssh-keygen and accept all the defaults. This will create the id_rsa and id_rsa.pub files in the default location ($HOME/.ssh). Finally, open your config file in your local repository (.git/config) and under remote "origin" use the ssh URL.
    – el_tigro
    Aug 18, 2021 at 20:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.