Mohamed Temraz
Mohamed Temraz

Reputation: 55

How to add ssh key in mac os?

I have an ssh key name.ppk I want to add by mac terminal to be able to clone from Git repository because when I am cloning from the repository it give me

Permission denied (publickey).
fatal: Could not read from remote repository.

Upvotes: 2

Views: 19618

Answers (3)

Abhishek Upadhyay
Abhishek Upadhyay

Reputation: 81

Follow the below step:

Step1: open terminal and paste below cmd with your email id which is being used in github or bitbucket or any other hosting service which you are using.

  ssh-keygen 

Step2: You will get: Generating public/private ssh key pair. no need to type anything just press enter.

Step3: You will get Enter file in which to save the key (/Users/abhishekupadhyay/.ssh/id_rsa): Again don't do anything just press enter.

Step4: You will get Your public key has been saved in /Users/abhishekupadhyay/.ssh/id_rsa.pub

Step5: The key fingerprint is: SHA256:0WHGzcQwaT4SabOuL2d2Yl3XPIJgP4E88LA39+rl8zk [email protected] The key's randomart image is: +--[ED25519 256]--+ | oB. | | o=++o+ | | .Bo | | .o@oo | | .S.*.+ o | | . +.o..o| | . . .oo. .| | o * o.o. E.| | B.o.. .oo.| +----[SHA256]-----+

Note: This is not a ssh key which you required for your hosting service(eg. github or bitbucket) your ssh key saved in .ssh/id_rsa.pub

Step6: For copy your public ssh key use below command:

pbcopy < ~/.ssh/id_rsa.pub

Step7: You will get ssh key adding option from: Right top icon click--Setting--SSH and GPG keys---New SSh key.

enter image description here

Step8: Paste your ssh key like below , and title would be like "accesstoken", Select key type: "Authentication key" and you are done.

enter image description here

===================================================================== Simple trick: paste below as press enter again and again tiill SHA-256 image comes up.

ssh-keygen 

Then

pbcopy < ~/.ssh/id_rsa.pub

Now ssh key is copy in clipboard. You can use now to paste.

Upvotes: 2

Stevethemacguy
Stevethemacguy

Reputation: 756

You can generate SSH keys (for git) in OSX by following these steps on GitHub: https://help.github.com/articles/generating-ssh-keys.

If you need to stick with the .ppk key (and Luchini's post doesn't work for you), you might also find this helpful: Use PPK file in Mac Terminal to connect to remote connection over SSH

Upvotes: 0

Related Questions