This is how to resolve the following command line error message when pushing your app to Heroku:
~/Desktop/appname git push heroku master
fatal: 'heroku' does not appear to be a git repository
fatal: Could not read from remote repository.
fatal: 'heroku' does not appear to be a git repository
Please make sure you have the correct access rights and the repository exists.
The above error message appears because there's no remote named heroku. When you do a heroku create, if the git remote doesn't already exist, Heroku automatically creates one assuming you're in a git repo.
You can see your remotes by typing git remote -v
. For my app app I see the following when checking which remote's exist:
~/Desktop/appname git remote -v
origin https://github.com/username/appname.git (fetch)
origin https://github.com/username/appname.git (push)
If you see a remote for your app, you can git push master
and replace with the actual remote name.
$ git remote -v
heroku git@heroku.com:appname.git (fetch)
heroku git@heroku.com:appname.git (push)
If the remote's missing, like it was for me, you can add the remote with the following command:
git remote add heroku git@heroku.com:appname.git
When I type "git push master", I get the following error. Its the same problem. claims I do not have access rights.
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
When push.default is set to 'matching', git will push local branches
to the remote branches that already exist with the same name.
In Git 2.0, Git will default to the more conservative 'simple'
behavior, which only pushes the current branch to the corresponding
remote branch that 'git pull' uses to update the current branch.
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)
fatal: 'master' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.