Connecting to Heroku using port 443

匿名 (未验证) 提交于 2019-12-03 02:20:02

问题:

I'm a university student and all ports except 80, 443 are blocked. I'm able to connect to github via

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

git push heroku master gives me this error:

ssh: connect to host heroku.com port 22: Connection refused fatal: The remote end hung up unexpectedly 

I've tried the solutions posted here on SO but I've still not got it working. Is there a way I can connect to heroku do deploy my websites?

Thanks a lot

回答1:

If your SSH port been blocked and wish to push into heroku using alternate port then you may consider Tunneling.

For tunneling you are required to have additional PC or Server resides outside of blocked network and having access to Port 22.

For the scenario below we can use house PC to tunnel into heroku server. Since the university network only allow Port 80 and 443, we can set the House PC to receive connection via port 443 and tunnel it to port 22.

At House PC:

  1. Configure SSH server in the house PC to run on port 443. Refer here to configure SSH Server on Multiple Ports

University PC:

  1. Configure University PC to resolve git_tunnel alias to point to localhost on port 9001. Edit ~/.ssh/config and add following

    # ~/.ssh/config  Host git_tunnel    Hostname 127.0.0.1    User git    Port 9001 
  2. Add a new remote alias as tunnel which will point to git@git_tunnel:{app name}.git

    git remote add tunnel git@git_tunnel:{app name}.git

  3. From the University PC establish tunnel to house PC which listening on port 443.

    ssh -L 9001:heroku.com:22 -p 443 root@housepc.com

  4. Deploy to heroku using alias tunnel created earlier

    git push tunnel master



回答2:

Heroku ssh only works over port 22. There is, however, a plugin that lets you push via HTTP. It does not use git, though. Instead, you heroku push.

https://github.com/ddollar/heroku-push



易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!