Skip to content

Instantly share code, notes, and snippets.

@bavey
Last active April 8, 2019 08:27
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bavey/8713170 to your computer and use it in GitHub Desktop.
Save bavey/8713170 to your computer and use it in GitHub Desktop.
Resolving Heroku/Git push deployment errors.

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

@hart-james
Copy link

Thanks!

@momenbasel
Copy link

Thanks!

@toshihidetagami
Copy link

It seems I typed "heroku create" in wrong place and worked now. Thanks!

@owen358
Copy link

owen358 commented Mar 22, 2017

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.

@steveross1975
Copy link

Thaaaaaaaank you!!! You saved me hours of head-smashing-over-the-monitor!

@amyhenning
Copy link

Thank you!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment