简体   繁体   中英

ruby on rails git permission denied

I am following this guide to set ruby on rails environment on my Mac El Captain.

I followed upto installing homebrew, ruby latest version 2.2.3 with rbenv. Now, I was setting up git.

Followed up first few commands

git config --global color.ui true
git config --global user.name "YOUR NAME"
git config --global user.email "YOUR@EMAIL.com"
ssh-keygen -t rsa -C "YOUR@EMAIL.com"

Now, I have been asked to save the generated key. I saved it to ~ directory with a name file . I have now two files namely file and file.pub .

I went to this link to copy ssh key. I clicked on Add SSH key option there. Named the key ROR SSH Key .

The key in file.pub looks like

ssh-rss asfjasfhjalsfdhaskfdhalsdfsdf\\asdf\\as\\dg\\sa\\fasdfas\\f\\asdf---so on random numbers---adfasdfasfa myemail@gmail.com

and I pasted the key there in github and saved the key.

Then, I went back to terminal and typed the below command.

ssh -T git@github.com

but I didn't received any message saying " Hi excid3! You've successfully authenticated, but GitHub does not provide shell access. "

I got a message saying

The authenticity of host 'github.com (192.30.251.130)' can't be established.
RSA key fingerprint is SHA256:nThbg6sdfgdfgsdfgGOCspRomTxdCARLviKw6E5SY8.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,192.30.251.130' (RSA) to the list of known hosts.
Permission denied (publickey).

Here above I have change few characters in SHA256 key. Just for security. Also, I have changed IP address a little bit for the same. But, the idea behind it is same.

Please guide me what's wrong. Thanks.

By default, ssh will look in the ~/.ssh folder for your private keys. Since you saved it in ~ instead, it can't find it.

You can either:

  1. Move the file and file.pub files into ~/.ssh and rename to id_rsa and id_rsa.pub , as OS X will automatically use those files for any ssh command (if you hadn't manually entered a filename, this is where ssh-keygen would have saved them).
  2. Use the ssh-add -K file command to permanently add your key to the OS X Keychain.

Note that GitHub's own instructions say they "strongly suggest keeping the default settings" instead of saving the private/public key somewhere else.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM