Github(SSH)通过公共WIFI,端口22被阻止

Github(SSH)通过公共WIFI,端口22被阻止,git,ssh,github,wifi,public,Git,Ssh,Github,Wifi,Public,我目前在公共WIFI站点上,无法使用SSH(他们可能阻止了该端口)。但是,我需要该连接来执行git推送 ➜ ssh -T git@github.com ssh: connect to host github.com port 22: Connection refused 是否可以通过端口80设置SSH隧道并告诉github push使用该连接来绕过此限制?怎么做?我在OSX(狮子)频道。这一定是一个常见问题?尝试以下方法: $ vim ~/.ssh/config 加 来源:同样适用于Bitb

我目前在公共WIFI站点上,无法使用SSH(他们可能阻止了该端口)。但是,我需要该连接来执行
git推送

➜ ssh -T git@github.com
ssh: connect to host github.com port 22: Connection refused
是否可以通过端口80设置SSH隧道并告诉github push使用该连接来绕过此限制?怎么做?我在OSX(狮子)频道。这一定是一个常见问题?

尝试以下方法:

$ vim ~/.ssh/config


来源:

同样适用于Bitbucket:

Host bitbucket.org
  Hostname  altssh.bitbucket.org
  Port  443
(过时/死亡)


(2015-10-29)

除了使用
~/.ssh/config
文件对其进行配置外,您还可以在使用的远程URL中简单地包含端口号。你只需要

  • 使用适当的URL,如
    ssh://user@主机:端口/路径
    而不是
    user@host:路径
    速记;及

  • ssh.
    子域前置到
    github.com

  • 例如,而不是

    git@github.com:cdbennett/python-gitlab.git
    
    使用


    对于gitlab,可以添加以下内容:

    Host gitlab.com
      Hostname altssh.gitlab.com
      User git
      Port 443
    

    来源:

    无需修改
    ~/.ssh/config
    。您可以通过
    git remote add..
    添加另一个远程存储库

    // github
    git remote add ssh://git@ssh.github.com:443/repo/name.git
    
    // gitlab
    git remote add ssh://git@altssh.gitlab.com:443/repo/name.git
    
    我有两种方法

    首先

    Host gitlab.com
            User git
            ProxyCommand ncat --proxy 127.0.0.1:8118 %h %p
    
        ProxyCommand nc --proxy 127.0.0.1:8118 %h %p
    
    • tor+torify
    在系统上成功安装和配置tor后,只需运行此命令以检查ssh是否使用tor

    torifyssh-Tvgit@gitlab.com


    • tor+privoxy+corkscrew
    首先从第一步开始配置tor。 然后安装privoxy以将tor SOCKS5转换为HTTP代理

    sudo-apt-install-privoxy

    然后安装开塞螺钉

    sudo apt安装开塞螺钉

    将此配置文件放入:~/.ssh/config

    host *
        ProxyCommand corkscrew 127.0.0.1 8118 %h %p
    
    或使用ncat

    Host gitlab.com
            User git
            ProxyCommand ncat --proxy 127.0.0.1:8118 %h %p
    
        ProxyCommand nc --proxy 127.0.0.1:8118 %h %p
    
    也可以使用nc代替ncat

    Host gitlab.com
            User git
            ProxyCommand ncat --proxy 127.0.0.1:8118 %h %p
    
        ProxyCommand nc --proxy 127.0.0.1:8118 %h %p
    
    现在ssh可以使用已配置的代理

    [编辑]

    更简单的版本

    在ssh命令之前使用torify

    torifyssh-Tvgit@gitlab.com


    要使用Privoxy+Tor,可能需要更改默认配置。 对我来说,在
    /etc/privoxy/config

    forward-socks5t   /               127.0.0.1:9050 .
    
    ssh配置

    Host *
        ProxyCommand nc --proxy 127.0.0.1:8118 %h %p
    

    @你知道heroku的配置是什么吗?仅供参考,你不必用vim打开文件。这太棒了!但我也需要为heroku做这件事。有什么想法吗?如果您在/home/...ssh/config上获得了
    坏所有者或权限,请参阅。谢谢!10年后,你的回答解决了我的问题!有人知道如何为Launchpad.net执行此操作吗?