-2

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?

Tyler
  • 1
  • 4
  • https://stackoverflow.com/search?q=%5Bgithub%5D+remote%3A+Support+for+password+authentication+was+removed+on+August+13%2C+2021 – phd Jun 22 '23 at 20:29

1 Answers1

0

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

HaroldH
  • 533
  • 1
  • 4
  • 10
  • Actually I needed to change the remote origin to contain a PAT I got from Github, and with this and the SSH key I was able to successfully push it. – Tyler Jun 22 '23 at 20:45