【问题标题】:Cannot git push to heroku master for ruby.railstutorial.org无法 git 推送到 ruby​​.railstutorial.org 的 heroku master
【发布时间】:2014-04-01 23:21:32
【问题描述】:

我在 ruby​​.railstutorial.org 上工作,我在将我的 first_app 从 git 推送到 heroku 时遇到了各种麻烦。我已经尝试了下面列出的解决方案,但仍然收到相同的错误消息。

我尝试过的解决方案: git push heroku master gives error ssh: connect to host heroku.com port 22: Connection refused git push heroku master gives error ssh: connect to host heroku.com port 22: Connection refused

I have tried precompiling as:
$ rake assets:precompile
$ git add .
$ git commit -m "Add precompiled assets for Heroku"

并获得一个新的 ssh 密钥。我似乎什么也做不了。这是我得到的:

Coreys-MacBook-Pro:first_app coreydavis$ heroku create
Creating radiant-oasis-3729... done, stack is cedar
http://radiant-oasis-3729.herokuapp.com/ | git@heroku.com:radiant-oasis-3729.git
Coreys-MacBook-Pro:first_app coreydavis$ git push heroku master
ssh: connect to host heroku.com port 22: Connection refused
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

我知道存储库存在并且我可以访问,但我无法弄清楚我在这里缺少什么。 任何帮助都会很棒,我对此非常非常陌生,尽管我阅读和谷歌搜索,但并不完全理解出了什么问题。非常感谢。

【问题讨论】:

  • 您是否重命名了应用程序或创建了多个 Heroku 应用程序?您可能正在尝试将 master 推送到不再存在的应用程序。查看 devcenter.heroku.com/articles/…stackoverflow.com/questions/6226846/… 删除 orgin
  • 谢谢克里斯,我发现我确实有多个应用程序,所以我删除了它们并尝试创建一个新应用程序,但是 $ git remote -v 仍然报告原始应用程序的名称。有什么方法可以让我清洁并重新开始?
  • 我已将其添加为答案

标签: ruby-on-rails ruby git heroku ssh


【解决方案1】:

如果您创建了多个应用程序,您仍然只能将原始应用程序作为遥控器。

git remote -v

向您显示您的遥控器的名称和网址。通常你会把它命名为 origin 并且你可以删除它:

git remote rm origin

然后你需要添加新的heroku应用名称:

git remote add origin <URL to new heroku app>

最后推送你的应用:

git push -u origin master

-u 标签会将其标记为已跟踪。

【讨论】:

    【解决方案2】:

    我以前遇到过这个问题。如果您的公钥丢失,则错误通常表明它。确保您已经登录到您的 GitHub 帐户并首先在那里创建了新的存储库。然后在命令行运行以下命令:

    git init
    git commit
    git remote add origin https://github.com/username/your_repository_name.git
    git push
    #you should be prompted to enter your github credentials
    #your code will then be pushed to your github repository
    git push heroku 
    #heroku will fetch your your github repository and install to your heroku instance
    heroku open
    #this will open your heroku instance in a new browser window. 
    

    祝你好运!

    【讨论】:

    • 太棒了,谢谢你,我今晚会试试这个,如果它有效,请告诉你!
    【解决方案3】:

    您需要为您的 Heroku 帐户分配一个公钥,如 in their docs 所述。

    另外,请仔细检查 git remote 是否确实是您期望的 Heroku 应用程序存储库。

    $ git remote -v

    您应该会在此命令的列表中看到您的 Heroku 应用名称。

    要检查的另一件事是,您没有位于阻止端口 22 的防火墙后面。这很不寻常,但并非闻所未闻。还有各种软件会阻止对 AWS/EC2 的访问;确保你没有运行类似的东西,因为 Heroku 在 EC2 上运行。

    【讨论】:

    • 所以我确实有多个应用程序,所以我在 heroku 上删除了它们并重新开始使用新的 $ heroku create 创建了一个新应用程序。然后我运行 $ git remote -v 它报告了我创建的原始应用程序的名称。有没有办法可以清除所有这些并重新开始?
    • 哦,我已经分配了一个公钥,我保存在本地,但仍然出现权限错误。
    猜你喜欢
    • 1970-01-01
    • 2011-11-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-07-27
    • 2013-09-11
    • 1970-01-01
    • 2023-04-03
    相关资源
    最近更新 更多