zoukankan      html  css  js  c++  java
  • 关于 git 本地创建 SSH Key 遇到的一点问题(①file to save the key & ②the authenticity of host...)

    背景

    由于想测试一下 SSH Key 创建的路径(.ssh 目录路径)对于不同位置 git 项目是否有效。

    比如,.ssh 默认在 C:[users][username] 目录下,而项目 project 在 D: 目录。测试结果是依然有效,即 .ssh 在 C:[users][username] 目录下时,在其他位置 push 时无需进行密码认证(测试时项目以 SSH clone)。

    PS:测试前已经将远程仓库托管平台公钥配置好。

    事件1(file to save the key)

    在本地创建 SSH Key 过程中:

    $ ssh-keygen -t rsa -C"email@xxx.xxx"

    Generating public/private rsa key pair.
    Enter file in which to save the key (/c/Users/[usrname]/.ssh/id_rsa):

    当在后面输入其它路径时发现不能键入.ssh,唯独默认路径中可包含 .ssh。不过只要路径中不包括 .xxx 即可生成  SSH Key。

    事件2(the authenticity of host...)

    首次 clone(SSH)时报错

    The authenticity of host 'gitee.com (xxx.xxx.xxx.xxx)' can't be established.
    ECDSA key fingerprint is xxxxxxxxxxxxxxxxxxx.
    Are you sure you want to continue connecting (yes/no)? yes
    Warning: Permanently added 'gitee.com,xxx.xxx.xxx.xxx' (ECDSA) to the list of known hosts.
    Bad packet length 2650498063.
    ssh_dispatch_run_fatal: Connection to xxx.xxx.xxx.xxx port 22: message authentication code incorrect
    fatal: Could not read from remote repository.

    Please make sure you have the correct access rights
    and the repository exists.

    事件2原因

    当你第一次使用Git的clone或者push命令连接GitHub时,会得到一个警告:

    The authenticity of host 'github.com (xx.xx.xx.xx)' can't be established.

    RSA key fingerprint is xx.xx.xx.xx.xx.

    Are you sure you want to continue connecting (yes/no)?

     这是因为Git使用SSH连接,而SSH连接在第一次验证GitHub服务器的Key时,需要你确认GitHub的Key的指纹信息是否真的来自GitHub的服务器,输入yes回车即可。

    Git会输出一个警告,告诉你已经把GitHub的Key添加到本机的一个信任列表里了:

    Warning: Permanently added 'github.com' (RSA) to the list of known hosts.

    这个警告只会出现一次,后面的操作就不会有任何警告了。

    原因参考: 廖雪峰的官方网站-GIT-添加远程仓库

  • 相关阅读:
    鼠标移上,内容显示
    Jquery横向菜单和纵向菜单的收起与展开
    适配不同大小浏览器——固定排班
    jQuery UI Widgets-menu
    Web前端的35个jQuery小技巧-转载
    android中listview中包含ratingbar响应不了点击事件
    点击空白区域,键盘向下收缩
    时间轮 Dialog 最简单的时间轮
    android 获取电话本中的联系人列表
    《网红经济》读后感
  • 原文地址:https://www.cnblogs.com/xunzhiyou/p/10568892.html
Copyright © 2011-2022 走看看