【问题标题】:Problem with git push remote behind proxy代理后面的 git push 远程问题
【发布时间】:2011-06-23 17:46:06
【问题描述】:

为了设置上下文,我正在尝试使用toto 来设置我的博客。
我做了

$ sudo gem install toto

gem 已正确安装。

Successfully installed rdiscount-1.6.8
Successfully installed toto-0.4.9
2 gems installed

之后,我尝试了

$ git clone git://github.com/cloudhead/dorothy.git myblog

但我收到以下错误

Cloning into myblog...
github.com[0: 207.97.227.239]: errno=Connection timed out
fatal: unable to connect a socket (Connection timed out)

我的 git http 代理设置是正确的

jatin@jatin-ubuntu:~/myblog$ git config --global http.proxy
http://proxy:port

我的 http_proxy 设置也是正确的

jatin@jatin-ubuntu:~$ echo $http_proxy
http://proxy:port/

所以,我把 git 换成了 http,为

$ git clone http://github.com/cloudhead/dorothy.git myblog

它奏效了。

现在,当我执行以下操作时

$ cd myblog
$ heroku create myblog

它工作到这里,我得到了

Creating myblog...... done
Created http://myblog.heroku.com/ | git@heroku.com:myblog.git
Git remote heroku added

但是这里失败了:

$ git push heroku master

然后出现以下错误

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

我不知道该怎么做,所以在谷歌搜索了一下后,我发现你无法使用 http 将更改推送到 github。
在进一步挖掘时,我发现了这个链接

how-to-use-the-git-protocol-through-a-http-connect-proxy

这表示您可以让防火墙管理员配置代理以允许 CONNECT 连接端口 9418,这是 git 使用的端口。

一旦他们正确配置了代理,您就可以使用 netcat-openbsd 或 socat 等工具进行连接。

我的问题是我是一名学生,我无法解决这个问题,因为我无法联系到管理员。我不知道该怎么办,因为我仍在寻找答案。

【问题讨论】:

    标签: ruby-on-rails git proxy github


    【解决方案1】:

    您也可以推送到https://cloudhead@github.com/cloudhead/dorothy.git(注意网址中的用户名)。

    【讨论】:

    • 我尝试推送到 git push https://github_username@github.com/app_name.git,但它返回了一个错误 error: The requested URL returned error: 500 while accessing https://github_username@github.com/app_name.git/info/refs
    • @Jatin:您似乎忘记了 repo 路径中的 repo 所有者。您需要在 @(作为用户名)之前和 github.com(作为存储库所有者)之后有 cloudhead。
    【解决方案2】:

    您使用此 URL git@heroku.com:myblog.git 添加了 heroku 远程。这可能是由heroku create 命令配置的。

    当您推送到此远程时,它是通过 SSH 完成的。这正是错误消息所表明的内容:您(或 git)试图通过 ssh 连接到 heroku.com,但由于您的防火墙(可能)拒绝了这一点而不能这样做。使用 git push heroku master 命令,您不是推送到 Github,而是推送到 Heroku 的 git 存储库。要将你的东西推送到 Github,你需要 git push origin master 并使用 ssh 或 http 进行传输。 git:// 协议本身不支持推送变更集,但它是一种未经身份验证的 re-only 协议。

    目前,Heroku 似乎只允许对其 git 存储库进行 SSH 传输,而且 Github 上似乎没有任何直接挂钩(请参阅Push from github to heroku without downloading repo)。这意味着要在 Heroku 上发布您的应用程序,您需要能够通过 SSH 从本地主机推送到 heroku.com。

    【讨论】:

      【解决方案3】:

      当你推送到这个远程时,它是通过 SSH 完成的。您收到的错误是因为客户端无法通过 SSH 连接,很可能是因为您位于阻止连接的某种类型的防火墙后面。当我试图下班推到 Heroku 时,我曾经遇到过同样的问题。

      我的建议是让你在本地开发,然后去一些公共热点将更改推送到 Heroku(比如星巴克)。

      【讨论】:

        猜你喜欢
        • 2018-12-06
        • 1970-01-01
        • 2011-04-29
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-09-27
        • 2021-09-09
        • 2017-12-10
        相关资源
        最近更新 更多