1

I'm trying to connect my heroku app to git repository.And also I can't able to push an existing repository with heroku app.While I'm trying to push with

git push heroku master

I found

fatal: 'heroku' does not appear to be a git repository
fatal: Could not read from remote repository.

How can I solve this?

Andrea
  • 169
  • 2
  • 12

3 Answers3

2

If you already have the heroku app and want to connect it you can use the cli to list your apps heroku apps

=== name@email.com Apps
app_name
app_name_2

Then connect it with can use heroku git:remote -a app_name as well

From this question: How to connect to the selected app with heroku CLI

It is worth noting that this does basically the same thing as creating the remote as @rdegges suggested.

You can check to make sure you are

  1. In the correct (git) directory and have cloned it down
  2. Have the heroku remote to push to

By running git remote -v, should look something like this:

heroku  https://git.heroku.com/app_name.git (fetch)
heroku  https://git.heroku.com/app_name.git (push)
origin  git@ssh.route/app_name.git (fetch)
origin  git@ssh.route/app_name.git (push)

Found a very well thought out and thorough answer to heroku in general here: https://stackoverflow.com/a/5129733/5491808

ContextCue
  • 323
  • 5
  • 14
0

That error means that: in your current project you have not yet 'initialized' Heroku.

Are you creating a NEW Heroku app? If so, you can run the following command to fix things:

heroku create

If you're trying to work with an EXISTING Heroku app, you need to setup your 'heroku remote' by doing the following:

git remote add heroku https://git.heroku.com/your-app-name.git
rdegges
  • 32,786
  • 20
  • 85
  • 109
  • usage: git remote add [] -f, --fetch fetch the remote branches --tags import all tags and associated objects when fetching or do not fetch any tag at all (--no-tags) -t, --track branch(es) to track -m, --master master branch --mirror[=] set up remote as a mirror to push to or fetch from – Andrea Aug 26 '16 at 17:13
  • Are you trying to use an existing Heroku app? Or create a new one? The error you are showing looks like you aren't using the `git remote` command I pasted above correctly. – rdegges Aug 26 '16 at 17:25
  • I'm creating a new heroku app. But I have an existing repository in Github. – Andrea Aug 27 '16 at 05:54
  • Then use the first command in the root of your project: `heroku create`. That will initialize the heroku remote for you. Once you've run `heroku create`, if you say `cat .git/config` you will see what I mean. You should then be able to do `git push heroku master` just fine. – rdegges Aug 27 '16 at 07:51
0

In order to connect with Heroku from anywhere you need these 3 files-

  • File name Procfile ( generic file - no file extension)
  • File name runtime.txt
  • File name requirements.txt

For details github link (please fork it & give me a star)

A.B
  • 1
  • 1
  • 1
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jul 30 '22 at 23:37