Heroku deployment, git remote not added

If you want to add a custom remote name:

heroku git:remote --app my-heroku-app-name -r my-custom-remote-name

To extend the answer from @tien-nguyen. An empty git repository should be initialized after running this:

git init

If running this right away:

git push heroku master

It will return this:

error: src refspec master does not match any.
error: failed to push some refs to 'heroku'

Very likely this is due to nothing is staged to be pushed. Add files, commit and try push again should fix the issue.

git add .
git commit -m "initial commit"
git push heroku master

This should commit and push the files into the repo.

In the case where git remote is not yet defined. Use the following:

heroku git:remote -a <name of the heroku app>
git remote -v

This should list out the remote url, should look something like this:

heroku  https://git.heroku.com/<name of the heroku app>.git (fetch)
heroku  https://git.heroku.com/<name of the heroku app>.git (push)

Now proceed with add, commit and push again.

Hope that helps!


One can go into the root of the app and run following command:

heroku git:remote -a 'app-name e.g radiant-garden-35190'

after that run following to see all the remotes associated with your app :

git remote -v

You should get a response like this :

heroku  https://git.heroku.com/radiant-garden-35190.git (fetch)
heroku  https://git.heroku.com/radiant-garden-35190.git (push)

You might not see the remote for your github if you have not committed your app yet.


Please do following command then enter:

git init

After that you can git push heroku master again