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

时间:2013-05-25 17:59:15

标签: ruby-on-rails git heroku

我将我的第5章Sample_App推送到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.

我已经阅读了一些类似的stackoverflow问题,所以我知道要看看'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)

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

我看了'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/*

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

3 个答案:

答案 0 :(得分:8)

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

cd .git
vim config

删除所有引用Heroku的行

cd ..
heroku create
git push heroku master

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

希望这会有所帮助。

答案 1 :(得分:2)

您是否尝试指定要推送的分支。试试git push heroku master。您可以阅读warning in the docs。让我知道它是否有效

修改

我会重新开始并创建一个新的Heroku地址。按顺序执行以下步骤

首先在Gemfile创建这些群组

group :development do
  gem 'sqlite3'
end

group :production do
  gem 'pg'
end

重要的是,请确保您位于root的{​​{1}},并确保您像这样运行project

bundle install

现在bundle install --without production 然后git add .

现在从命令行运行git commit -m 'your commit message'

现在运行heroku login

然后heroku create

最后git push heroku master将在您的浏览器中打开您的应用

如果所有这些都不起作用,请将应用移至新的指南,然后先由heroku opengit initgit add .重新开始,然后按照上述步骤{ {1}}

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

答案 2 :(得分:0)

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

相关问题