.ssh 迁移

  • ssh 文件夹迁移的一点坑

  • 资料来源:

    <>

  • 更新

    1
    2021.03.22 初始

导语

最近进行了一次系统翻新,最重要的 ssh-key 提前备份还原,结果一地鸡毛…

无法登录

复制粘贴的密钥首先是权限问题.

1
2
3
4
# 修改文件夹权限
chmod 700 ~/.ssh
# 修改文件
chmod 600 -R ~/.ssh/*

之后能正常登录服务器了

github 无法登录

能正常登录服务器了,但是 github 始终提示错误 “Host Key Verification Failed” when connecting to remote repository

最后在 Git error: “Host Key Verification Failed” when connecting to remote repository 找到了答案.

要把 github.com 加入 known_hosts.

1
`ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts`