Franklin Ohaegbulam
Franklin Ohaegbulam

Franklin Ohaegbulam

Http Request Exception encountered [SOLVED]

Http Request Exception encountered [SOLVED]

Generating an Open SSH Public Key for Git

Franklin Ohaegbulam's photo
Franklin Ohaegbulam
·May 9, 2022·

2 min read

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 HTTP 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:

ls .ssh 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 "your@email.com

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

cat .ssh/id_rsa.pub

This will return a long string of SHA256 encrypted message known as Key fingerprint. Copy to clipboard.

Add SSH to SSH agent program

ssh-agent -s

Add rsa key to SSH

ssh-ad .ssh/id_rsa 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 git@github.com

Now, you can clone a repository using SSH and successfully push your local respository to GitHub without issues.

 
Share this