Permission denied (publickey).


Headnotes

Many equations and formulas look intimidating. However, when you hunt them down, they are definitely not! Just papertigers!

Now let's hunt the papertiger.

A problem occurred while I `git push` to my git server on ec2.

I handled this by following this three guide of which their original links are:

http://stackoverflow.com/questions/13363553/git-error-host-key-verification-failed-when-connecting-to-remote-repository

https://chenhuachao.com/2016/05/26/ssh%E5%87%BA%E9%94%99-sign-and-send-pubkey-signing-failed-agent-refused-operation/

Sorry for missing out the second source link, I will add that later.

Firstly, check your url if it’s right. If it’s outdated, update it with:

git remote set-url origin git://new.url.here

 

sign_and_send_pubkey: signing failed: agent refused operation
Permission denied (publickey).
fatal: Could not read from remote repository.

  1. mkdir ~/.ssh
  2. vim known_hosts – if you already have known_hosts, skip this.
  3. ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts
  4. ssh-keygen -t rsa -C "user.email"
  5. Add the id_rsa.pub key to SSH keys list on your GitHub profile.

Set up your client

  1. Generate your key
    • ssh-keygen
  2. Configure ssh to use the key
    • vim ~/.ssh/config
  3. Copy your key to your server
    • ssh-copy-id -i /path/to/key.pub SERVERNAME

Your config file from step 2 should have something similar to the following:

Host SERVERNAME
Hostname ip-or-domain-of-server
User USERNAME
PubKeyAuthentication yes
IdentityFile ./path/to/key

eval “$(ssh-agent -s)”
ssh-add


Footnotes

There are many excellent tutorials out there. Some tutorials are too intuitive and it's helpful, but you cannot get it straight on the math details. Some focused on dymestifying math. Some focused on code. I found the best tutorials that give you the conceptual ideas and are possible for implementation without being blind to the math details. Drop a comment if I failed. It would be really appreciable.


If you want to cite this article, please cite this article as:

Lachlan Chen, "Permission denied (publickey).," in EarnFromScratch, 三月 21, 2017, https://www.earnfs.com/zh/html/1340.htm.

or

@misc{lachlanchen2020tutorial,
title=Permission denied (publickey).,
author={Chen, Lachlan},
year=三月 21, 2017
}


EarnFromScratch (九月 26, 2020) Permission denied (publickey).. Retrieved from https://www.earnfs.com/zh/html/1340.htm.
"Permission denied (publickey).." EarnFromScratch - 九月 26, 2020, https://www.earnfs.com/zh/html/1340.htm
EarnFromScratch 三月 21, 2017 Permission denied (publickey).., viewed 九月 26, 2020,<https://www.earnfs.com/zh/html/1340.htm>
EarnFromScratch - Permission denied (publickey).. [Internet]. [Accessed 九月 26, 2020]. Available from: https://www.earnfs.com/zh/html/1340.htm
"Permission denied (publickey).." EarnFromScratch - Accessed 九月 26, 2020. https://www.earnfs.com/zh/html/1340.htm
"Permission denied (publickey).." EarnFromScratch [Online]. Available: https://www.earnfs.com/zh/html/1340.htm. [Accessed: 九月 26, 2020]


发表评论