SSH Key is not working

I need help. I’m having problems accesing with my SSH Key. I’ve done all the steps to authenticate with a SSH Key but it didn’t work:

  1. I made a key with ssh-keygen.
  2. open ~/.ssh/id_rsa.pub and copy the key.
  3. Go to account settings on github.com
  4. Go to SSH Keys
  5. Click on the Add Key button.
  6. paste the key into the key box.
  7. Save the key (enter my github password to verify).

I’m running git 2.25.1 over WSL 2 (Ubuntu) on a Windows 10 machine.

It looks as though you have successfully added keys to your account so I think that’s sorted.

If you’re having trouble authenticating with your SSH key, we have some steps here for troubleshooting SSH.

If that doesn’t work, you can always share what you are trying to do and what kind of errors you’re seeing- that will help folks come up with suggestions.

Even though I have already placed my key correctly, when I try to git push to one of my repositories it keeps asking for my credentials.

jesus1554@jesus1554:/mnt/c/Users/jesus/prog/sotano$ git push origin publish
Username for 'https://github.com':

What can I do? The use of github credentials on the terminal is near to be deprecated.

@jesus1554, here are a couple of things to check
Within your local Git have you configured the correct URL for SSH as opposed to HTTPS protocol
SSH: git@github.com:jesus1554/sotano.git
HTTPS: https://github.com/jesus1554/sotano.git
Some further details here changing-a-remotes-url

You can still choose to use HTTPS, with a personal access token (instead of a password) if you prefer to having to use SSH.
If you use HTTPS you can create a token with the needed repository permissions, see creating-a-personal-access-token

Once you have a token, you can enter it instead of your password when performing Git operations over HTTPS.
For example, on the command line you would enter the following:
$ git clone https://github.com/username/repo.git
Username: your_username
Password: your_token

1 Like

The problem now is resolved.

Thanks!