2014-02-28 41 views
0

我正在ruby.railstutorial.org上工作,我有很多讓我的first_app從git推到heroku的麻煩。我嘗試了下面列出的解決方案,但不斷收回相同的錯誤消息。不能git推到heroku master ruby​​.railstutorial.org

解決方案我曾嘗試: 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/ | [email protected]: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. 

我知道存在的存儲庫,我有訪問,我無法弄清楚我在這裏失蹤。 任何幫助都會很棒,我對此非常非常陌生,並且完全不瞭解即使通過閱讀和谷歌搜索發生了什麼問題。非常感謝。

+0

你有沒有重新命名應用程序或創建多個heroku應用程序?您可能試圖將主人推送到不再存在的應用程序。查看https://devcenter.heroku。com/articles/renaming-apps#manually-updating-a-git-remote and http://stackoverflow.com/questions/6226846/how-to-change-a-git-remote-on-heroku刪除orgin – ChrisBarthol

+0

謝謝克里斯,我發現我確實有多個應用程序,所以我刪除了它們並嘗試創建一個新應用程序,但$ git remote -v仍在報告原始應用程序的名稱。有沒有一種方法可以清潔並開始新鮮? – user3353784

+0

我已將它添加爲答案 – ChrisBarthol

回答

0

您需要爲您的Heroku帳戶分配一個公鑰,如in their docs所述。

另外,仔細檢查一下,git remote實際上是你期望它的Heroku應用程序庫。

$ git remote -v

你應該散發出來這個命令的列表中看到您的Heroku應用程序名稱。

另一件要檢查的事情是,你並不是在防止阻塞端口22的防火牆後面。這是不常見的,但並不是前所未聞的。還有各種阻止訪問AWS/EC2的軟件;確保自Heroku在EC2上運行以來,你沒有像這樣運行任何東西。

+0

因此,我確實有多個應用程序,因此我在heroku上刪除了它們,並開始使用新的$ heroku創建新的應用程序。然後我運行$ git remote -v並報告我創建的原始應用程序的名稱。有沒有一種方法可以清除所有這些並開始新鮮? – user3353784

+0

哦,我已經分配了一個公鑰,我將它保存在本地,但仍然收到權限錯誤。 – user3353784

0

我以前有過這個問題。如果你的公鑰丟失,錯誤通常表示它。確保你已經登錄到你的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. 

祝您好運!

+0

真棒,謝謝你,今晚我會試試這個,並且讓它知道它是否有效! – user3353784

0

如果您創建了多個應用程序,您仍然只有原件作爲遠程。

git remote -v

顯示了你的遙控器被命名爲和URL。通常你會已將其命名由來,你可以將其刪除:

git remote rm origin

然後你需要添加新的Heroku應用程序名稱:

git remote add origin <URL to new heroku app>

最後把你的應用程序:

git push -u origin master

-u標記將標記爲跟蹤。