Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not read from remote repository when pushing to Heroku (Rails Tutorial 5)

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  [email protected]:sample_app.git (fetch)
heroku  [email protected]:sample_app.git (push)
origin  [email protected]:jeffbenner/sample_app.git (fetch)
origin  [email protected]: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
[email protected]
alias.co=checkout
push.defaults=simple
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
core.ignorecase=true
core.precomposeunicode=false
[email protected]:jeffbenner/sample_app.git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master
[email protected]: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.

like image 362
jeffbenner Avatar asked May 25 '13 17:05

jeffbenner


2 Answers

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

cd .git
vim config

removed all lines referencing Heroku

cd ..
heroku create
git push heroku master

... And voila, it worked.

Hoped this helps.

like image 156
Mathieu Avatar answered Sep 18 '22 15:09

Mathieu


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.

like image 25
fontno Avatar answered Sep 18 '22 15:09

fontno