Fix 'git push permission denied public key' error with these easy steps

If you're getting a "git push permission denied public key" error, it means that there's an issue with your SSH key setup. Fortunately, the solution is relatively straightforward. Here are the steps to fix the error:

├Źndice
  1. Step 1: Check Your SSH Key Setup
  2. Step 2: Generate a New SSH Key
  3. Step 3: Add Your New SSH Key to GitHub
  4. Step 4: Test Your SSH Connection

Step 1: Check Your SSH Key Setup

The first thing you should do is check that your SSH key is set up correctly. You can do this by running the following command in your terminal:

ssh -T git@github.com

If your SSH key is set up correctly, you should see a message that says "Hi [your username]! You've successfully authenticated, but GitHub does not provide shell access." If you don't see this message, you'll need to set up your SSH key.

Step 2: Generate a New SSH Key

If your SSH key isn't set up correctly, you'll need to generate a new one. To do this, run the following command in your terminal:

ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

Be sure to replace "your_email@example.com" with your actual email address.

Step 3: Add Your New SSH Key to GitHub

Once you've generated a new SSH key, you'll need to add it to your GitHub account. To do this, copy the contents of your public key (the file with a .pub extension in your ~/.ssh directory) and go to your GitHub account settings. From there, click on "SSH and GPG keys" and then "New SSH key." Paste the contents of your public key into the "Key" field and click "Add SSH key."

Step 4: Test Your SSH Connection

Finally, you'll want to test your SSH connection to make sure everything is working as expected. Run the following command in your terminal:

ssh -T git@github.com

You should see the "Hi [your username]! You've successfully authenticated, but GitHub does not provide shell access." message again. If you do, you're all set!

By following these easy steps, you should be able to fix the "git push permission denied public key" error and get back to pushing your code to GitHub in no time.

Click to rate this post!
[Total: 0 Average: 0]

Related posts

Leave a Reply

Your email address will not be published. Required fields are marked *

Go up

Below we inform you of the use we make of the data we collect while browsing our pages. You can change your preferences at any time by accessing the link to the Privacy Area that you will find at the bottom of our main page. More Information