美文网首页
git ssh中config配置代理

git ssh中config配置代理

作者: rick_zhu | 来源:发表于2021-04-29 16:53 被阅读0次

    使用git clone git@xxxx项目时,ssh方式;出现如下错误:

    ssh: connect to host gitLab.cdyoue.com.cn port 22: Connection timed out
    fatal: Could not read from remote repository.
    
    Please make sure you have the correct access rights
    and the repository exists.
    

    我遇到的问题主要时连接不上gitLab.cdyoue.com.cn,这时候打开本地C:\Users\Administrator.ssh文件夹;
    新增config文件,无后缀。
    在config文件中写:

    Host gitLab.cdyoue.com.cn
        User git
        # SSH默认端口22, HTTPS默认端口443
        Port 22
        # 你要代理的地址
        Hostname 172.16.0.18
        # 这里放你的SSH私钥
        IdentityFile ~\.ssh\id_rsa
        PreferredAuthentications publickey
    

    再次下拉项目成功:


    image.png

    相关文章

      网友评论

          本文标题:git ssh中config配置代理

          本文链接:https://www.haomeiwen.com/subject/fbywrltx.html