Andrea
Andrea

Reputation: 179

How can I connect a git repository to heroku app

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?

Upvotes: 1

Views: 1738

Answers (3)

A.B
A.B

Reputation: 1

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)

Upvotes: 0

ContextCue
ContextCue

Reputation: 323

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

=== [email protected] 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  [email protected]/app_name.git (fetch)
origin  [email protected]/app_name.git (push)

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

Upvotes: 2

rdegges
rdegges

Reputation: 33824

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

Upvotes: 0

Related Questions