The error message shows that the SSH public key on your local machine does not match the SSH key on your GitHub account. So, you need to delete the old SSH key from your GitHub account and add the SSH public key from your local machine to the GitHub account.
Here are the steps to fix the error:
- Change directory (cd) to the ".ssh" folder in your home directory. If you have generated an SSH key pair, the SSH public key (id_rsa.pub) should be in this folder. If you have not generated SSH key pair, read the instructions to generate RSA SSH key pair here.
- Run the following command to get the SSH public key. Copy the complete key, including "ssh-rsa".
- Log into your GitHub account. Go to Account Settings > SSH and GPG keys. Under "SSH Keys", click on the "New SSH key" button and paste the SSH public key in the "Key" text area. Also, give some title to the key, e.g., "office computer" or "home computer", etc. Click on the "Add SSH key" button.
- Close the terminal and reopen it. Now, you should not get the error while running the "push" command.