This means, on your local machine, you haven’t made any SSH keys. Here’s how to fix:
- 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!).
- Type cd ~/.ssh. This will take you to the root directory for Git (Likely C:\Users[YOUR-USER-NAME].ssh\ on Windows).
- Within the .ssh folder, there should be these two files:
- 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.
- To create the SSH keys, type ssh-keygen -t rsa -C «email@example.com». This will create both id_rsa and id_rsa.pub files.
- Now, go and open id_rsa.pub in your favorite text editor.
- 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.
- Now that you’ve added your public key to Github and/or BitBucket, try to git push again and see if it works.
4 comentarios sobre “Permission Denied (publickey) error when I push!”
It’s perfect time to make some plans for the future and it’s time to be happy. I’ve read this post and if I could I want to suggest you few interesting things or advice. Perhaps you could write next articles referring to this article. I wish to read even more things about it!| а
Thanks for your comment. I hope it has helped you.
A person essentially lend a hand to make critically posts I’d state.
This is the very first time I frequented your website page and so far?
I surprised with the research you made to make this actual submit extraordinary.
It was the way I found to solve my problem. I really enjoy this can help anyone else.