purplemystic
V2EX  ›  GitHub

最近无法通过 ssh 方式 clone github 项目

  •  
  •   purplemystic ·
    pplmx · Jan 29, 2024 · 5174 views
    This topic created in 1010 days ago, the information mentioned may be changed or developed.

    failed to clone repo by ssh

    image.png

    有人遇到么,

    • 是 github 调整了什么策略么?
    • 还是 clash 出现 bug 了, 导致无法 ssh 方式无法走代理?
    • 或者 git 出现 bug 了, git version: git version 2.43.0.windows.1
    41 replies  •  2024-01-30 09:11:50 +08:00
    haoyunyinglai
    haoyunyinglai
    Jan 29, 2024
    1
    是不是密钥失效了?
    Martens
    Martens
    Jan 29, 2024
    2
    +1 我也遇到了,还以为是代理的问题
    silverwolf
    silverwolf
    Jan 29, 2024
    3
    网上复制的一段我用的代理办法
    <pre>
    # ~/.ssh/config
    Host github.com
    Hostname github.com
    ServerAliveInterval 55
    ForwardAgent yes
    ProxyCommand nc -x 127.0.0.1:10808 %h %p
    </pre>
    vicalloy
    vicalloy
    Jan 29, 2024
    4
    最近一直这样,我还以为是个例。
    purplemystic
    purplemystic
    OP
    Jan 29, 2024
    5
    @daxin945 不行, 重新生成了, 也不行
    jonah
    jonah
    Jan 29, 2024
    7
    配置 http.proxy 对 SSH 不起作用,SSH 需要单独配置。

    [Git 使用 SSH 传输协议的代理方法
    ]( https://ericclose.github.io/git-proxy-config.html#Git-%E4%BD%BF%E7%94%A8-SSH-%E4%BC%A0%E8%BE%93%E5%8D%8F%E8%AE%AE%E7%9A%84%E4%BB%A3%E7%90%86%E6%96%B9%E6%B3%95)
    purplemystic
    purplemystic
    OP
    Jan 29, 2024
    8
    @Martens 我将能怀疑的都怀疑了一遍, 哈哈
    purplemystic
    purplemystic
    OP
    Jan 29, 2024
    9
    @jonah 之前都是可以的, 能够识别代理的
    AresChang
    AresChang
    Jan 29, 2024❤️1
    10
    可能是墙加厚,可以用这个改一下 host ,速度很快。

    https://github.com/521xueweihan/GitHub520
    univ
    univ
    Jan 29, 2024
    11
    +1
    chunqiuyiyu
    chunqiuyiyu
    Jan 29, 2024
    12
    在 ~/.ssh/config 中添加如下内容,没有这个文件就新建一个:
    ```
    Host github.com
    Hostname ssh.github.com
    Port 443
    ```
    我是这样解决的。
    XXWHCA
    XXWHCA
    Jan 29, 2024❤️2
    13
    ssh 代理需要单独配置
    ```
    cat .ssh/config
    Host github.com
    Hostname ssh.github.com
    IdentityFile /Users/xxx/.ssh/id_ed25519
    User git
    Port 443
    ProxyCommand nc -v -x 127.0.0.1:7890 %h %p
    ```
    jonah
    jonah
    Jan 29, 2024
    14
    @purplemystic 我之前不配代理 https 和 ssh 都可以访问的,最近感觉墙厚了 ╮(╯_╰)╭
    licoycn
    licoycn
    Jan 29, 2024
    15
    同步一下 hosts 即可: https://github.com/Licoy/fetch-github-hosts
    purplemystic
    purplemystic
    OP
    Jan 29, 2024
    16
    @silencetea 按照你给的配置后, 可以生效, 赞
    doco
    doco
    Jan 29, 2024
    17
    听说是新加坡的 github 地址有问题, 换美国那边的 vpn 大概率解决问题
    purplemystic
    purplemystic
    OP
    Jan 29, 2024
    18
    @doco 不行的, 因为 Copilot 和 ChatGPT 原因, 我一直使用的是美国的
    doco
    doco
    Jan 29, 2024❤️1
    19
    @purplemystic 看一下你连的 github 的 ip 是哪个吧, 20.205.243.166 这个好像不行, 140.82.113.4 这个应该是没问题的
    purplemystic
    purplemystic
    OP
    Jan 29, 2024
    20
    @doco 的确是的, 直接这样, 无需设置任何代理, 就是可以工作的

    > git clone [email protected]:x-pt/template.git
    MrQSJ
    MrQSJ
    Jan 29, 2024
    21
    可以换成 https ,我遇到之后用 https+代理,通过了
    crysislinux
    crysislinux
    Jan 29, 2024 via Android
    22
    我的没问题,走的香港。不过 github 本身也是推荐用 https ,你就换 https 好了。
    purplemystic
    purplemystic
    OP
    Jan 29, 2024
    23
    @crysislinux 不是应该推荐使用 ssh 方式么?
    Alliot
    Alliot
    Jan 29, 2024 via Android
    24
    https://www.iots.vip/post/elegant-solution-git-multiple-accounts-proxy-issues.html 可以参考一下
    DawnMoon
    DawnMoon
    Jan 29, 2024
    25
    Alliot
    Alliot
    Jan 29, 2024 via Android
    26
    @Alliot 文末有附文档 ssh over https
    shelken
    shelken
    Jan 29, 2024❤️2
    27
    这两天刚好遇到这个问题:
    in `~/.ssh/config`
    ```conf
    Host github.com
    User git
    HostName ssh.github.com
    Port 443
    ```
    devliu1
    devliu1
    Jan 29, 2024 via Android
    29
    墙了 楼上说过了
    rockxsj
    rockxsj
    Jan 29, 2024
    30


    windows 11 ,加入这个配置即可 代理端口 11808 自行替换
    wudx
    wudx
    Jan 29, 2024
    31
    直接
    ```
    export https_proxy=http://127.0.0.1:7890;export http_proxy=http://127.0.0.1:7890;export all_proxy=socks5://127.0.0.1:7890
    ```
    不就可以了吗
    wudx
    wudx
    Jan 29, 2024
    32
    @wudx 忽略此回答,没有注意是 ssh 方式...
    wonderfulcxm
    wonderfulcxm
    Jan 29, 2024 via iPhone
    33
    就算 ssh ,clash pro 增强模式应该也可以直接走代理吧。
    purplemystic
    purplemystic
    OP
    Jan 29, 2024
    34
    @0x723b 这个也是一个解决方法
    nagisaushio
    nagisaushio
    Jan 29, 2024 via Android
    35
    用 proxychains 就好了,命令行网不好直接加个前缀
    d4fg4
    d4fg4
    Jan 29, 2024 via Android
    37
    机场会屏蔽 22 端口
    danhua
    danhua
    Jan 29, 2024
    38
    设置一下 git SSH 代理就可以了,上周也碰见了。通过这个方式可以正常访问了。
    litguy
    litguy
    Jan 29, 2024
    39
    早晨试着 clone 了代码
    用 socks5 代理,很快
    BardOS
    BardOS
    Jan 29, 2024
    40
    我都是用 bat 自动更新 github520 这个 hosts 文件,速度一直挺快的。
    IvanLi127
    IvanLi127
    Jan 30, 2024 via Android
    41
    机场不好。不想换机场节点就试试 ssh over https ,github 有支持。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   5510 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 83ms · UTC 02:28 · PVG 10:28 · LAX 18:28 · JFK 21:28
    ♥ Do have faith in what you're doing.