推送到Heroku时无法从远程存储库中读取(Rails教程5)

时间:2022-03-12 00:16:21

I pushed my chapter 5 version of Sample_App to git, and then when I 'git push heroku' I get:

我将Sample_App的第5章版本推送到git,然后当我'git push heroku'时,我得到:

warning: push.default is unset; its implicit value is changing in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the current behavior after the default changes, use:

git config --global push.default matching

To squelch this message and adopt the new behavior now, use:

git config --global push.default simple

See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)


!  No such app as sample_app.

fatal: Could not read from remote repository.

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

I have read through some of the similar * questions, and so I know to look at the 'git remote -v':

我已经阅读了一些类似的*问题,所以我知道看看'git remote -v':

heroku  git@heroku.com:sample_app.git (fetch)
heroku  git@heroku.com:sample_app.git (push)
origin  git@github.com:jeffbenner/sample_app.git (fetch)
origin  git@github.com:jeffbenner/sample_app.git (push)

I have tried removing heroku and re-pushing - I get the same error message.

我已经尝试删除heroku并重新推送 - 我收到相同的错误消息。

I looked at 'git config -l':

我看了'git config -l':

user.name=jeffbenner
user.email=xxxxx@gmail.com
alias.co=checkout
push.defaults=simple
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
core.ignorecase=true
core.precomposeunicode=false
remote.origin.url=git@github.com:jeffbenner/sample_app.git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master
remote.heroku.url=git@heroku.com:sample_app.git
remote.heroku.fetch=+refs/heads/*:refs/remotes/heroku/*

I cannot figure out why I cannot push to Heroku. I have re-logged into both my Github and Heroku accounts through the CLI. Any direction would be much appreciated.

我无法弄清楚为什么我不能推向Heroku。我通过CLI重新登录了我的Github和Heroku帐户。任何方向都会非常感激。

3 个解决方案

#1


2  

Did you try to specify the branch that you are pushing. Try git push heroku master. You can read about the warning in the docs. Let me know if it worked

您是否尝试指定要推送的分支?试试git push heroku master。您可以在文档中阅读有关警告的信息。如果有效,请告诉我

Edit

编辑

I would just start over all together and create a new Heroku address. Follow these steps in order

我会重新开始,创建一个新的Heroku地址。按顺序执行这些步骤

First in your Gemfile create these groups

首先在Gemfile中创建这些组

group :development do
  gem 'sqlite3'
end

group :production do
  gem 'pg'
end

Important, make sure you are in the root of your project and make sure you run bundle install like this

重要的是,请确保您位于项目的根目录中,并确保像这样运行bundle install

bundle install --without production

now git add . then git commit -m 'your commit message'

现在git add。然后git commit -m'你的提交消息'

now run heroku login from the command line

现在从命令行运行heroku登录

now run heroku create

现在运行heroku创建

then git push heroku master

然后git push heroku master

finally heroku open will open your app in your browser

最后heroku open将在您的浏览器中打开您的应用程序

If all of this doesn't work then move the app into a new directoy and start all over by first git init, git add . and git commit -m 'first commit in new location' and follow the steps above starting with heroku login

如果所有这些都不起作用,那么将应用程序移动到新的directoy并通过第一个git init,git add重新开始。和git commit -m'首先在新位置提交'并按照上面的步骤从heroku登录开始

Note that heroku and github both use git but are independent entities. If you can push your code to github and you see it on github, then you should be able to push your code to heroku with no problem. If not you may be doing something wrong with git locally on your computer.

注意,heroku和github都使用git但是是独立的实体。如果您可以将代码推送到github并在github上看到它,那么您应该能够毫无问题地将代码推送到heroku。如果不是,您可能在计算机上本地使用git做错了。

#2


8  

I just came across the same problem. I did the following:

我刚遇到同样的问题。我做了以下事情:

cd .git
vim config

removed all lines referencing Heroku

删除所有引用Heroku的行

cd ..
heroku create
git push heroku master

... And voila, it worked.

......瞧,它有效。

Hoped this helps.

希望这会有所帮助。

#3


0  

I had no idea why, but stopping running foreman in my local machine allowed a push to heroku master... Could be coincidence :|

我不明白为什么,但是停止在我的本地机器上运行工头允许推送到heroku主人......可能是巧合:|

#1


2  

Did you try to specify the branch that you are pushing. Try git push heroku master. You can read about the warning in the docs. Let me know if it worked

您是否尝试指定要推送的分支?试试git push heroku master。您可以在文档中阅读有关警告的信息。如果有效,请告诉我

Edit

编辑

I would just start over all together and create a new Heroku address. Follow these steps in order

我会重新开始,创建一个新的Heroku地址。按顺序执行这些步骤

First in your Gemfile create these groups

首先在Gemfile中创建这些组

group :development do
  gem 'sqlite3'
end

group :production do
  gem 'pg'
end

Important, make sure you are in the root of your project and make sure you run bundle install like this

重要的是,请确保您位于项目的根目录中,并确保像这样运行bundle install

bundle install --without production

now git add . then git commit -m 'your commit message'

现在git add。然后git commit -m'你的提交消息'

now run heroku login from the command line

现在从命令行运行heroku登录

now run heroku create

现在运行heroku创建

then git push heroku master

然后git push heroku master

finally heroku open will open your app in your browser

最后heroku open将在您的浏览器中打开您的应用程序

If all of this doesn't work then move the app into a new directoy and start all over by first git init, git add . and git commit -m 'first commit in new location' and follow the steps above starting with heroku login

如果所有这些都不起作用,那么将应用程序移动到新的directoy并通过第一个git init,git add重新开始。和git commit -m'首先在新位置提交'并按照上面的步骤从heroku登录开始

Note that heroku and github both use git but are independent entities. If you can push your code to github and you see it on github, then you should be able to push your code to heroku with no problem. If not you may be doing something wrong with git locally on your computer.

注意,heroku和github都使用git但是是独立的实体。如果您可以将代码推送到github并在github上看到它,那么您应该能够毫无问题地将代码推送到heroku。如果不是,您可能在计算机上本地使用git做错了。

#2


8  

I just came across the same problem. I did the following:

我刚遇到同样的问题。我做了以下事情:

cd .git
vim config

removed all lines referencing Heroku

删除所有引用Heroku的行

cd ..
heroku create
git push heroku master

... And voila, it worked.

......瞧,它有效。

Hoped this helps.

希望这会有所帮助。

#3


0  

I had no idea why, but stopping running foreman in my local machine allowed a push to heroku master... Could be coincidence :|

我不明白为什么,但是停止在我的本地机器上运行工头允许推送到heroku主人......可能是巧合:|