falcon.guru
falcon.guru

Reputation: 33

GitHub SSH Key Issue - Permission Denied

Everyone. I'm so glad to post this question here.

I've been googling so far and I found some answer about this permission issue but they didn't help me. After generating new SSH keys and adding to GitHub my own Account, this problem is being issued continuously. I use Ubuntu 16.04. If you have correct to this question, please let me know. I'll be happy by your any idea, so please recommend any solution.

Thanks for your time. Falcon.Guru

Upvotes: 0

Views: 4644

Answers (3)

falcon.guru
falcon.guru

Reputation: 33

Rohit and gturri. Thanks for your kind answer. I've tried these way to solve this issue But they weren't solution. I just solved this problem. This issue is related to File Permission, not SSH configuration. I pulled it down with this command:

sudo chmod -R 777 YOUR DIRECTORY URL

Thanks Everybody.

Upvotes: 0

Rohit Poudel
Rohit Poudel

Reputation: 1889

Help, I keep getting a 'Permission Denied (publickey)' error when I push!

This means, on your local machine, you haven't made any SSH keys. Not to worry. Here's how to fix:

  1. Open git bash (Use the Windows search. To find it, type "git bash") or the Mac Terminal. Pro Tip: You can use any *nix based command prompt (but not the default Windows Command Prompt!)
  2. Type cd ~/.ssh. This will take you to the root directory for Git (Likely C:\Users\[YOUR-USER-NAME]\.ssh\ on Windows)
  3. Within the .ssh folder, there should be these two files: id_rsa and id_rsa.pub. These are the files that tell your computer how to communicate with GitHub, BitBucket, or any other Git based service. Type ls to see a directory listing. If those two files don't show up, proceed to the next step. NOTE: Your SSH keys must be named id_rsa and id_rsa.pub in order for Git, GitHub, and BitBucket to recognize them by default.
  4. To create the SSH keys, type ssh-keygen -t rsa -C "[email protected]". This will create both id_rsa and id_rsa.pub files.
  5. Now, go and open id_rsa.pub in your favorite text editor (you can do this via Windows Explorer or the OSX Finder if you like, tpying open . will open the folder).
  6. Copy the contents--exactly as it appears, with no extra spaces or lines--of id_rsa.pub and paste it into GitHub and/or BitBucket under the Account Settings > SSH Keys. NOTE: I like to give the SSH key a descriptive name, usually with the name of the workstation I'm on along with the date.
  7. Now that you've added your public key to Github and/or BitBucket, try to git push again and see if it works. It should!

    More info

Upvotes: 1

gturri
gturri

Reputation: 14629

It might be because you're not using an ssh url. To check this, run

git remote -v

it will print the adresses of your remote repositories. It should look like

origin [email protected]:<user-name>/<project-name>

If it looks like

origin  https://github.com/<user-name>/<project-name>

then it's not good. You can fix it with the command

git remote set-url origin [email protected]:<user-name>/<project-name>

Upvotes: 0

Related Questions