GitHub recently stopped the use of username and password to authenticate a
git push due to Identity and security reasons. And this new development was challenging to me because I found it difficult at first to push my project to the remote respository.
The old way to associate a commit was:
git config --global user.name "Your username" git config --global user.email "Your email"
The above method works when you fork and clone a repository using
Following this update, if you try pushing to GitHub, you are likely to come across this error;
Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.
Steps to Generate an Open SSH public key:
This command list your SSH key files if there is any.
"No such file or directory" shows that it doesn't exist yet.
So, let's generate one using the command;
Generate a new key
ssh-keygen -o -t rsa -C "firstname.lastname@example.org
Skip with ENTER key when asked to "Enter file in which to save the key". This saves it directly in PC.
You will be prompted to enter a
passphrase. Hit the ENTER key twice to bypass
If you have an existing SSH key, enter this command to display it.
Display the contents of your SSH public key
This will return a long string of SHA256 encrypted message known as Key fingerprint. Copy to clipboard.
Add SSH to SSH agent program
Add rsa key to SSH
The rsa key is alphanumeric looks like gc_54340
Log on to Github, Click settings then navigate to SSK keys.
On Add SSH key, paste the encrypted SSK Key and give it any title e.g Your PC name.
Verify the authentication between your local system and GitHub (Optional)
ssh -t email@example.com
Now, you can clone a repository using SSH and successfully push your local respository to GitHub without issues.