如何通过苛刻的代理使用GitHub? [英] How do I use GitHub through harsh proxies?

查看:170
本文介绍了如何通过苛刻的代理使用GitHub?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果有以下限制,我如何从Windows和Unix使用GitHub?




  • 所有对互联网的访问仅限于代理

  • 代理只允许在端口80和443上连接

  • CONNECT方法仅适用于443

  • 需要代理身份验证(NTLM或Basic) 请参阅通过Draconian Proxies(Windows和Unix)使用Github通过Jeff Tchang(以前可从另一个地点 ),其中包括Windows和Unix平台的指令,总结如下。



    Unix




    1. 下载Git。

    2. 下载并安装 corkscrew 编辑或创建文件〜/ .ssh / config 并放入以下内容:


        ProxyCommand / usr / bin / corkscrew代理.example.com 443%h%p〜/ .ssh / myauth 

      主机github.com
      用户git
      端口22
      主机名github.com
      IdentityFile/media/truecrypt1/Keys/GitHubKey.private
      TCPKeepAlive yes
      IdentitiesOnly yes

      Host ssh.github.com
      User git
      端口443
      主机名ssh.github.com
      IdentityFile/media/truecrypt1/Keys/GitHubKey.private
      TCPKeepAlive是
      IdentitiesOnly是
      ssh github .com
      并参见


      您好用户!您已成功通过身份验证,但GitHub不提供shell访问权限。

      与github.com的连接已关闭。


      如果这不起作用,你可以运行 ssh ssh.github.com 并得到完全一样的东西。如果第一个命令不起作用,则意味着您使用阻止端口22上的CONNECT的代理。几乎没有代理阻止端口443上的CONNECT,因为您需要SSL。

    3. / ol>

      Windows




      1. 下载 msysgit 。一些设置:


        • 从Windows命令提示符运行Git

        • 使用OpenSSH重要的)

        • 选择您的行结尾


      2. 下载 connect.c 。这个工具值得自己发表,主要是因为它非常简单。它反映了开源工具开瓶器,用于通过代理进行隧道传输。是的,该工具的名称实际上称为connect.c。对于Windows用户,可以使用预编译的二进制文件。我将 connect.exe 放入 C:\ Windows \connect.exe 中。

      3. 确定您是否喜欢使用Windows cmd.exe 来创建东西或Cygwin样式的外壳。或者两者兼而有之。

      4. 设置Cygwin Git bash shell。


        $ b 为Cygwin样式shell启动Git图标并编辑文件〜/ .ssh / config 并确保该文件没有扩展名。


          ProxyCommand / c / windows / connect.exe -H username@proxy.example.com:443%h%p 

        主机github.com
        用户git
        端口22
        主机名github .com
        IdentityFile/c/Keys/GitHubKey.private
        TCPKeepAlive是
        IdentitiesOnly是

        Host ssh.github.com
        User git
        端口443
        主机名ssh.github.com
        IdentityFile/c/Keys/GitHubKey.private
        TCPKeepAlive yes
        IdentitiesOnly yes


      5. 设置Windows cmd.exe shell。



        假设你不喜欢Git Bash shell。您更喜欢cmd.exe解释器。




        • 转到您的配置文件 C:\Documents and Settings\\ \\.ssh\config

        • 制作一份副本或制作一份新副本。我打电话给我的 config-windows



        注意路径分隔符和样式。


          ProxyCommand C:/Windows/connect.exe  - H username@proxy.example.com:443%h%p 

        主机github.com
        用户git
        端口22
        主机名github.com
        IdentityFileC:\Keys\GitHubKey.private
        TCPKeepAlive是
        IdentitiesOnly是

        主机ssh.github.com
        用户git
        端口443
        主机名ssh.github.com
        IdentityFileC:\Keys\GitHubKey.private
        TCPKeepAlive是
        IdentitiesOnly是



      有关完整详情,请参阅完整的博客文章


      Given the following constraints, how can I use GitHub from Windows and Unix?

      • All access to the internet is restricted to a proxy
      • The proxy only allows connections out on port 80 and 443
      • CONNECT method is only enabled for 443
      • Proxy Authentication is required (NTLM or Basic)

      解决方案

      See a "Using Github Through Draconian Proxies (Windows And Unix)" by Jeff Tchang (formerly available from another location), which includes instructions for both Windows and Unix platforms, summarized below.

      Unix

      1. Download Git.
      2. Download and install corkscrew.
      3. Edit or create the file ~/.ssh/config and put the following:

        ProxyCommand /usr/bin/corkscrew proxy.example.com 443 %h %p ~/.ssh/myauth
        
        Host github.com
        User git
        Port 22
        Hostname github.com
        IdentityFile "/media/truecrypt1/Keys/GitHubKey.private"
        TCPKeepAlive yes
        IdentitiesOnly yes
        
        Host ssh.github.com
        User git
        Port 443
        Hostname ssh.github.com
        IdentityFile "/media/truecrypt1/Keys/GitHubKey.private"
        TCPKeepAlive yes
        IdentitiesOnly yes
        

      4. If everything is setup correctly you should be able to run ssh github.com and see

        Hi user! You’ve successfully authenticated, but GitHub does not provide shell access.
        Connection to github.com closed.

        If this doesn’t work you can run ssh ssh.github.com and get the exact same thing. If the first command didn’t work it means you are using a proxy that blocks CONNECT on port 22. Almost no proxies block CONNECT on port 443 because you need that for SSL.

      Windows

      1. Download msysgit. Some settings:
        • "Run Git from the Windows Command Prompt"
        • "Use OpenSSH" (this one is very important)
        • Pick your line endings
      2. Download connect.c. This tool deserves its own post mostly because of its utter simplicity. It mirrors the open source tool corkscrew and is used for tunneling through proxies. Yes the tool’s name is really called "connect.c." For Windows users, a pre-compiled binary is available. I put my connect.exe in C:\Windows\connect.exe.
      3. Decide whether you like to use the Windows cmd.exe to do stuff or the Cygwin style shell. Or both.
      4. Set up the Cygwin Git bash shell.

        For the Cygwin style shell start up the Git icon and edit the file ~/.ssh/config and make sure the file has no extension. Put the following in that file, and note how the paths are specified.

        ProxyCommand /c/windows/connect.exe -H username@proxy.example.com:443 %h %p
        
        Host github.com
        User git
        Port 22
        Hostname github.com
        IdentityFile "/c/Keys/GitHubKey.private"
        TCPKeepAlive yes
        IdentitiesOnly yes
        
        Host ssh.github.com
        User git
        Port 443
        Hostname ssh.github.com
        IdentityFile "/c/Keys/GitHubKey.private"
        TCPKeepAlive yes
        IdentitiesOnly yes
        

      5. Set up the Windows cmd.exe shell.

        Suppose you don’t like the Git Bash shell. You prefer the cmd.exe interpreter.

        • Go to your config file at C:\Documents and Settings\.ssh\config
        • Make a copy of it or make a new one. I called mine config-windows

        Put the following in the file, again paying careful attention to path separators and styles.

        ProxyCommand C:/Windows/connect.exe -H username@proxy.example.com:443 %h %p
        
        Host github.com
        User git
        Port 22
        Hostname github.com
        IdentityFile "C:\Keys\GitHubKey.private"
        TCPKeepAlive yes
        IdentitiesOnly yes
        
        Host ssh.github.com
        User git
        Port 443
        Hostname ssh.github.com
        IdentityFile "C:\Keys\GitHubKey.private"
        TCPKeepAlive yes
        IdentitiesOnly yes
        

      For full details, see the full blog post.

      这篇关于如何通过苛刻的代理使用GitHub?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆