簡體   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