eme*_*ery 25 github fingerprint
我在工作中使用我的项目,但我想在家与他一起工作,因为我可以登录我的家用机器来处理我的项目。
但是,在家里,我看到以下消息:
The authenticity of host 'github.com (ip)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
Are you sure you want to continue connecting (yes/no)?
Run Code Online (Sandbox Code Playgroud)
我怎样才能克服它?
Emm*_*uni 29
只需通过以下方式将 Github 指纹添加到已知主机即可:
mkdir -p ~/.ssh
ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts
Run Code Online (Sandbox Code Playgroud)
Von*_*onC 24
你应该 只需能够回答“是”,这将更新您的~/.ssh/known_hosts文件。
一个更好的办法,以避免任何MITM(人在这方面的中间人)攻击,将是(如评论下面通过Mamsds)来验证GitHub的公钥第一(见“ GitHub的SSH密钥指纹”),并且如果你找到一个匹配,那么您可以回答“是”。
之后,您可以使用 GitHub SSH URL(前提是您已生成 SSH 公钥/私钥,并将公钥注册到您的 GitHub 个人资料)
注意:ssh 密钥生成应使用 base64 旧 PEM 格式(选项-m PEM),而不是新的当前 70 个字符的 OpenSSH格式。
请参阅“凭证中私钥的正确格式是什么”:
ssh-keygen -m PEM -t rsa -P "" -f afile
Run Code Online (Sandbox Code Playgroud)
那或者您可以切换到 HTTPS URL。
Sha*_*kil 15
当您第一次尝试使用 SSH 连接到 Github(~/.ssh/known_hosts目前还没有 Github 的条目)时,系统会要求您验证远程主机的密钥指纹。因为,如果入侵者主机将自己表示为 Github 服务器,则其 RSA 指纹将与 GitHub 服务器指纹不同。
你有两个选择。
考虑到您不关心远程主机(在本例中为 Github)的真实性,您可以接受,或者,
你可以验证你实际上得到连接到Github的服务器,通过匹配您呈现给RSA指纹(在提示),与GitHub的SSH密钥指纹的base64格式。
后一种选择通常更可取。
按照此GitHub 帮助页面上讨论的步骤进行操作。
https://help.github.com/en/github/authenticating-to-github/connecting-to-github-with-ssh
git config --global url."https://github.com/".insteadOf git@github.com:
git config --global url."https://".insteadOf git://
Run Code Online (Sandbox Code Playgroud)
git config --global url."git@github.com:".insteadOf https://github.com/
git config --global url."git://".insteadOf https://
Run Code Online (Sandbox Code Playgroud)
小智 6
打开 Git Bash
检查现有的 SSH 密钥:
$ ls -al ~/.ssh
如果您已经拥有它们,您将看到:
- id_rsa.pub
- id_ecdsa.pub
- id_ed25519.pub
如果不这样做,请生成一个(按 Enter 接受默认文件位置):
$ ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
要将密钥复制到剪贴板:
$ clip < ~/.ssh/id_rsa.pub
转到您在 Github/Settings/SSH 和 GPG 密钥/新 SSH 密钥上的帐户
将您的密钥粘贴到那里
接下来,输入:
$ git remote
如果您看到 origin,请将其删除:
$ git remote remove origin
继续 GitHub 存储库页面上提供的最后 2 个步骤...
$ git remote add origin git@github.com:USERNAME/REPONAME.git
$ git push -u origin master
刷新您的 GitHub 存储库页面
瞧!