简体   繁体   English

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

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

I am working on the ruby.railstutorial.org and I am having all sorts of trouble getting my first_app to push from git to heroku. 我正在ruby.railstutorial.org上工作,让我的first_app从git推送到heroku时遇到了种种麻烦。 I have tried the solutions listed below but keep getting back the same error messages. 我已经尝试了下面列出的解决方案,但仍会收到相同的错误消息。

Solutions I have tried: 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 我尝试过的解决方案: 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"

and getting a new ssh key. 并获取新的ssh密钥。 I can't seem to get anything to work. 我似乎什么也无法工作。 Here is what I am getting: 这是我得到的:

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.

I know the repository exists and I have access, I can't figure out what I am missing here. 我知道存储库存在并且可以访问,我无法弄清楚这里缺少什么。 Any help would be great, I am very, very new to this and don't totally understand what is going wrong despite my reading and google searches. 任何帮助都将非常有用,我对此非常,非常陌生,即使我阅读和使用Google搜索,也无法完全理解出了什么问题。 Thanks so much. 非常感谢。

You need to assign a public key to your Heroku account, as described in their docs . 您需要按照其docs中的说明为您的Heroku帐户分配一个公钥。

Also, double-check that the git remote is actually the Heroku app repository that you expect it to be. 另外,再次检查git remote实际上是您期望的Heroku应用程序存储库。

$ git remote -v

You should see your Heroku app name in the list that comes out of this command. 您应该在此命令的列表中看到您的Heroku应用名称。

Another thing to check is that you are not behind a firewall that is blocking port 22. That would be unusual, but not unheard of. 要检查的另一件事是,您不是位于阻止端口22的防火墙后面,这是不常见的,但并非闻所未闻。 There are also various software that will block access to AWS/EC2; 还有各种软件会阻止对AWS / EC2的访问; make sure you're not running anything like that since Heroku runs on EC2. 确保您没有运行任何类似的东西,因为Heroku在EC2上运行。

I've had this issue before. 我以前有过这个问题。 If you're public key is missing the error usually indicates it. 如果您的公钥丢失,错误通常会指出。 Make sure that you've logged into your GitHub account and created the new repository there first. 确保您已登录GitHub帐户并首先在其中创建了新的存储库。 Then run the following on the command line: 然后在命令行上运行以下命令:

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. 

Good luck!! 祝好运!!

If you created multiple apps you'll still only have your original as the remote. 如果您创建了多个应用,则仍然只能将原始应用作为远程应用。

git remote -v

shows you what your remotes are named and the url. 显示您的遥控器名称和网址。 Usually you'll have it named origin and you can remove it with: 通常,您将其命名为origin,可以使用以下方法将其删除:

git remote rm origin

Then you need to add the new heroku app name: 然后,您需要添加新的heroku应用名称:

git remote add origin <URL to new heroku app>

Finally push your app: 最后推送您的应用程序:

git push -u origin master

The -u tag will mark it as tracked. -u标记会将其标记为已跟踪。

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

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