推向Heroku时无法从远程存储库读取(Rails Tutorial 5) [英] Could not read from remote repository when pushing to Heroku (Rails Tutorial 5)
问题描述
我将Sample_App的Chapter 5版本推送到git,然后当我'git push heroku'时,警告:push.default未设置;它的隐含价值在
Git 2.0中从匹配变为简单。要压制此消息
并在默认更改后维护当前行为,请使用:
git config --global push.default匹配
若要压制此消息并现在采用新的行为,使用:
git config --global push.default简单
请参阅'git help config'并搜索'push.default'以获取更多信息。
(简单模式在Git 1.7.11中引入)如果您有时使用旧版本的Git,请使用类似模式
'current'而不是'simple'
!没有像sample_app这样的应用程序。
致命:无法从远程存储库读取。
请确保您拥有正确的访问权限
并存在存储库。
我已经阅读了一些类似的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(推送)
我尝试删除heroku并重新推送 - 我收到相同的错误消息。
我查看了'git config -l':
user.name = jeffbenner
user.email=xxxxx@gmail.com
alias.co =结帐
push.defaults =简单
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.maste r.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帐户。任何方向将不胜感激。
您是否尝试指定要推送的分支?试试 git push heroku master
。您可以阅读有关文档中的警告。让我知道它是否有效
编辑
我会一起重新开始创建一个新的Heroku地址。按顺序执行这些步骤
首先在您的 Gemfile
创建这些组
group:development do
gem'sqlite3'
end
group:production do
gem'pg '
end
重要的是,确保您位于根目录
项目
并确保你运行 bundle install
像这样
捆绑安装 - 无需生产
现在 git add。
然后 git commit -m'您的提交信息'
现在从命令行运行 heroku login
现在运行 heroku create
然后 git push heroku master
最后 heroku open
将会在您的浏览器中打开您的应用程序
如果全部这不起作用,然后将应用程序移动到一个新的directoy中,并通过首先 gi重新开始t init
, git add。
和 git commit -m'在新位置第一次提交'
并按照上面的步骤开始 heroku login
请注意,heroku和github都使用git,但都是独立的实体。如果你可以将你的代码推送到github上,并且你在github上看到它,那么你应该可以将你的代码推送到heroku,而不会有任何问题。如果没有,你可能会在你的计算机上在本地做git错误。
I pushed my chapter 5 version of Sample_App to git, and then when I 'git push heroku' I get:
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 stackoverflow questions, and so I know to look at the '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.
I looked at '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.
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
Edit
I would just start over all together and create a new Heroku address. Follow these steps in order
First in your Gemfile
create these groups
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 --without production
now git add .
then git commit -m 'your commit message'
now run heroku login
from the command line
now run heroku create
then git push heroku master
finally heroku open
will open your app in your browser
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
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时无法从远程存储库读取(Rails Tutorial 5)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!