Warning of RSA host key while cloning git repository

给你一囗甜甜゛ 提交于 2020-01-24 12:42:30

问题


I am using git bash to clone my github repository and getting warning continuously I am using SSH so, I use this git command: git clone git@github.com:TapanHP/HTextView but it gives warning like this

Warning: Permenantly added the RSA host key for IP address to the list of known hosts

Enter passphrase for key 'c/users/tapanhp/.ssh/id_rsa':

what is this passphrase? and why this happens?


回答1:


The SSH connection to GitHub uses RSA, a form public key cryptography. This means that you have a private key and a public key. You give others your public key (in this case, GitHub), and use your private key to encrypt data. They can then decrypt the data using your public key, which will only decrypt information that was encrypted with your private key. As long as no one else has your private key, they can't pretend to be you.

In practical terms, you presumably have the files c/users/tapanhp/.ssh/id_rsa and c/users/tapanhp/.ssh/id_rsa.pub.

id_rsa.pub is your public key, and id_rsa is your private key. To help keep it private, whoever generated it chose a passphrase to encrypt it with. That is the passphrase that is being asked for.

If you generated this key pair, then it is whatever you chose. If someone else did, then it is whatever they chose.

If no one knows the passphrase, you will have to generate a new key pair and give GitHub the new public key.

GitHub provides a nice guide for doing this: https://help.github.com/articles/generating-an-ssh-key/

The warning message is just telling you that it is associating the IP address of GitHub's SSH server with their encryption key. This is done to help prevent man-in-the-middle attacks.




回答2:


For me, this problem cropped up after switching to two-factor authentication.

To solve the issue, I switched from:

git clone https://github.com/user/repo.git

to the SSH version:

git clone git@github.com:user/repo.git

This worked fine -- no password prompt, just cloned as I'd been accustomed to pre-2FA.



来源:https://stackoverflow.com/questions/38278905/warning-of-rsa-host-key-while-cloning-git-repository

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!