'Git' Not Authenticating due to Password Authentication Being Removed

I need to push a cloned repo back to Github, but when I run git push -u -f origin main in the folder that I’ve initialized and added a remote origin to, it returns this error:

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/BusyBird15/WeatherOne.git/'

How do I authenticate myself when the main authentication method has been removed?

>Solution :

The main authentication method for GitHub is SSH, which you can read about in their documentation: https://docs.github.com/en/authentication/connecting-to-github-with-ssh

As a summary, partially taken from GitHub own documentation, you should:

  1. Generate a SSH key, using for it a command like: ssh-keygen -t ed25519 -C "your_email@example.com"
  2. If using linux, modify the permissions of the key files with chmod 600 keyFile
  3. Add the key to your GitHub profile, under Settings -> SSH keys
  4. Add the key to your git installation, with ssh-add ~/.ssh/id_ed25519

You’ll have to then adjust your origins to point to the ssh endpoints of your repository. The one you linked would be: git@github.com:BusyBird15/WeatherOne.git

Leave a Reply