繁体   English   中英

无法git push到ruby.railstutorial.org的heroku主目录

[英]Cannot git push to heroku master for ruby.railstutorial.org

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

我尝试过的解决方案: git push heroku master提供错误ssh:连接到主机heroku.com端口22:连接被拒绝 git push heroku master提供错误ssh:连接到主机heroku.com端口22:连接被拒绝。

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.

我知道存储库存在并且可以访问,我无法弄清楚这里缺少什么。 任何帮助都将非常有用,我对此非常,非常陌生,即使我阅读和使用Google搜索,也无法完全理解出了什么问题。 非常感谢。

您需要按照其docs中的说明为您的Heroku帐户分配一个公钥。

另外,再次检查git remote实际上是您期望的Heroku应用程序存储库。

$ git remote -v

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

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

我以前有过这个问题。 如果您的公钥丢失,错误通常会指出。 确保您已登录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. 

祝好运!!

如果您创建了多个应用,则仍然只能将原始应用作为远程应用。

git remote -v

显示您的遥控器名称和网址。 通常,您将其命名为origin,可以使用以下方法将其删除:

git remote rm origin

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

git remote add origin <URL to new heroku app>

最后推送您的应用程序:

git push -u origin master

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM