Switching from HTTPS to SSH on GitHub

Problem

Password authentication has been disabled since August 13, 2021

Username for 'https://github.comUsername for ': andreiolegovichru Password for Username for 'https://andreiolegovichru@github.comUsername for ': remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead. remote: Please see https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ for more information. fatal: Authentication failed for Username for 'https://github.com/andreiolegovichru/spider-den/Username for '

You need to switch to another authentication method - for example via SSH

Solution

cd ~/.ssh
ssh-keygen -t ed25519 -C "username@email.ru"
eval `ssh-agent -s`
ssh-add ~/.ssh/id_ed25519
cat ~/.ssh/id_ed25519.pub

Open in a browser

https://github.com/settings/keys

New SSH key

Paste the key there and save

git remote set-url origin git@github.com:yourgitusername/yourrepo.git
git remote -v

Article author: Andrei Olegovich