Could not read from remote repository when pushing to Heroku (Rails Tutorial 5)
Solution 1
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.
Solution 2
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.
jeffbenner
Updated on June 14, 2022Comments
-
jeffbenner almost 2 years
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.
-
jeffbenner almost 11 years
git push heroku master
yields: ` ! 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.` -
fontno almost 11 yearswhat is the URL to your heroku app?
-
jeffbenner almost 11 yearsFrom surveying my previous apps on Heroku, it does not look like I have ever successfully pushed a commit of sample_app before (none of the hashes match what's on github). I just tried
heroku create
from the sample_app directory, and thengit push heroku master
, and I get the same error. Here is the URL. -
jeffbenner almost 11 yearsThis is the error message I get, to be more precise: Creating quiet-sands-7291... done, region is us quiet-sands-7291.herokuapp.com | [email protected]:quiet-sands-7291.git jeffrey-benners-macbook:sample_app Jeffrey$ git push heroku master ! 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.
-
jeffbenner almost 11 yearsThank you @fontno! Starting with everything copied into a new directory worked. I don't want to trouble you for more, but is there possibly a place where I could read about what was wrong, and how this resolved the issue?
-
fontno almost 11 yearsNo problem, glad it worked. You should start with really learning git inside and out. Here is the git book. Also chapter one of the tutorial book your following has more info about all the commands in my post. And read the developer docs on Heroku, there are many things to learn. Good luck
-
Sheharyar almost 11 yearsThanks, this worked! Well, instead of creating app from scratch i did
heroku git:remote -a myappname
-
Daryll Santos over 10 yearsJust to add,
vim config
means you open a text editor and remove the heroku referencing lines. In my case it wassubl config
.