git push heroku master error: Repository not found

I just tried pushing to heroku from github and this happened, anyone know how to fix this?

$ git push heroku master
ERROR: Repository not found.
fatal: The remote end hung up unexpectedly

Solution 1:

Inside your project folder go into .git/config and look at what (if anything) is defined under the heroku remote.

For example, one of my apps has:

[remote "origin"]
  url = [email protected]:jefflunt/cortex.git
  fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
  remote = origin
  merge = refs/heads/master
[remote "heroku"]
  url = [email protected]:cortex-cedar.git
  fetch = +refs/heads/*:refs/remotes/heroku-cedar/*

...where origin is the github repo, master is the master branch on github, and heroku is the name and path to the repository on heroku.

It's important that (a) you have an entry for heroku because that's what makes your push work, and (b) that it's pointed at the correct path/repo.

To get the path/repo for your project go into you application settings on heroku and it should be listed.

On a side note, these lists of remotes in your .git/config file are what make the aliases that you use on the command line work at all, and the names they are given are simply found in the config file.

Solution 2:

When I encountered this issue I just deleted this line of code from the .git/config file then I tried repushing to heroku(git push heroku master).

[remote "heroku"]
    url = https://git.heroku.com/dry-bastion-47289.git
    fetch = +refs/heads/*:refs/remotes/heroku/*

Solution 3:

For the easy solution remove the existing heroku git repo and recreate it.

git remote rm heroku

and then recreate it

heroku create

and later if you want to rename

heroku rename <name of your app>