• Win7 SourceTree 使用 ssh key 连接 github


    1、SourceTree 下载

    2、注册 SourceTree。 C:Users用户AppDataLocalAtlassianSourceTree 下面 新建 account.json文件,内容如下

    [  
      {  
        "$id": "1",  
        "$type": "SourceTree.Api.Host.Identity.Model.IdentityAccount, SourceTree.Api.Host.Identity",  
        "Authenticate": true,  
        "HostInstance": {  
          "$id": "2",  
          "$type": "SourceTree.Host.Atlassianaccount.AtlassianAccountInstance, SourceTree.Host.AtlassianAccount",  
          "Host": {  
            "$id": "3",  
            "$type": "SourceTree.Host.Atlassianaccount.AtlassianAccountHost, SourceTree.Host.AtlassianAccount",  
            "Id": "atlassian account"  
          },  
          "BaseUrl": "https://id.atlassian.com/"  
        },  
        "Credentials": {  
          "$id": "4",  
          "$type": "SourceTree.Model.BasicAuthCredentials, SourceTree.Api.Account",  
          "Username": "",  
          "Email": null  
        },  
        "IsDefault": false  
      }  
    ]  

    3、生成ssh key,并添加进 SourceTree

    使用OpenSSH    参考自这里: https://docs.github.com/en/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent

    // 替换 邮箱 然后生成ssh key
    $ ssh-keygen -t ed25519 -C "your_email@example.com" 
    
    # start the ssh-agent in the background
    $ eval `ssh-agent -s`
    > Agent pid xxxx
    
    // 将 ssh key 添加进 ssh-agent
    $ ssh-add ~/.ssh/id_ed25519
    
    // 拷贝进 剪贴板
    $ clip < ~/.ssh/id_ed25519.pub

    进入到 github 头像位置 => Settings => SSH and GPG keys => New SSH key or Add SSH key  粘贴,然后保存。

    或者使用 PuTTY 生成 

    SourceTree => 工具 => 启动 SSH 助手

     点击 Generate,它会根据你 随机移动鼠标的轨迹 来生成,生成结束后将 Key 的内容添加到 github 后台,这里跟 OpenSSH 的流程一致。

    同时点击 Save private key 到本地目录,是一个 ppk 文件。 然后在 SourceTree => 工具 => 选项 =>

     SSH 客户端 选择 PuTTY/Plink, SSH 密钥 选择你保存的 ppk 文件就 OK 了

    4、使用 git  clone 仓库

    git@github.com:xxxx/xxxx.git

    5、如果出现 Warning: Permanently added the RSA host key for IP address 'xxx.xxx.xxx.xxx' to the list of known host

    将这个ip 地址添加进 host 文件即可。

    Win7  host 文件地址: 

    C:WindowsSystem32driversetchosts  

    参考: https://zhuanlan.zhihu.com/p/51072467

  • 相关阅读:
    【题解】 P1373 小a和uim之大逃离
    题解 CF576C 【Points on Plane】
    题解 P4799 【[CEOI2015 Day2]世界冰球锦标赛】
    【题解】[JSOI2008]最大数
    题解 P3389 【【模板】高斯消元法】
    【模板】矩阵加速
    【模板】树状数组上的差分数组
    tarjan求强连通分量(模板)
    我好菜系列——map查找
    trie树的应用;
  • 原文地址:https://www.cnblogs.com/lesten/p/14575453.html
Copyright © 2020-2023  润新知