【问题标题】:What is the better way of git clone private repos?git clone 私人仓库的更好方法是什么?
【发布时间】:2022-01-02 17:07:12
【问题描述】:

以前 SSH 用于 git clonepush 与密钥,但如果默认端口 22 在代理和无代理环境中被阻止或克隆怎么办。

在 Python 脚本中克隆的更好方法是什么?

【问题讨论】:

    标签: git github ssh


    【解决方案1】:

    尝试添加这个:

    Host github.com
    Hostname ssh.github.com
    Port 443
    User git
    

    来源:Github

    【讨论】:

    • 您的答案可以通过额外的支持信息得到改进。请edit 添加更多详细信息,例如引用或文档,以便其他人可以确认您的答案是正确的。你可以找到更多关于如何写好答案的信息in the help center
    【解决方案2】:

    如果 22 端口被阻塞,则使用 HTTP 协议。

    git clone http://github.com/user_name/repo
    

    【讨论】:

    • 如果有个人访问令牌可以用 https:// 克隆,但我不希望用户提示进行身份验证。
    【解决方案3】:

    在 Github 你可以使用主机 ssh.github.com 的 443 端口:

    git clone ssh://git@ssh.github.com:443/user/repo.git
    

    请参阅docs

    【讨论】:

      猜你喜欢
      • 2015-04-08
      • 1970-01-01
      • 2016-06-29
      • 1970-01-01
      • 2020-05-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-12-04
      相关资源
      最近更新 更多