prashantgpt91
prashantgpt91

Reputation: 1795

Deploy Code on Heroku

When i try to run

git push heroku master

it gives error saying

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

just before running this command I had pushed my code to bitbucket because of which

git remote -v

is showing

origin  https://[email protected]/prashant/code.git (fetch)
origin  https://[email protected]/prashant/code.git (push)

How can i deploy my code to heroku while continue my source code versioning on Bitbucket?

Is it necessary to change the remote origin everytime when

I know this sounds non sense, but as a beginner this is the only thing coming to my mind

EDIT sequence of steps:

heroku login 

Git init

heroku create

git add . 

git commit -am "give some comment"

git remote add origin https://[email protected]/prashant/code.git

git push heroku master

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

Upvotes: 0

Views: 731

Answers (2)

Simone Carletti
Simone Carletti

Reputation: 176402

In order to push a branch to Heroku, hence deploy the code, Heroku repository must be configured as a remote repository for your git project.

Which means, when you run git remote you should see the Heroku repo there.

To add link a repo to an existing Heroku app, simply use

$ git remote add heroku "PATH_TO_THE_HEROKU_APP"

See also https://devcenter.heroku.com/articles/git#creating-a-heroku-remote

After that, you'll be able to deploy by running

$ git push heroku master

Upvotes: 2

Shyam Bhimani
Shyam Bhimani

Reputation: 1270

Heroku and Bitbucket is two different thing though some command are similar. Try this to deploy your app to heroku.

I assume you already have created account on heroku. If not click here and make one.

Go to your terminal, change the directory to where your app is and run below commands

heroku login 

Git init

heroku create

git add . 

git commit -am "give some comment"

git push heroku master

This will work, read this for more information on what is git , heroku , and GitHub (GitHub is similar to Bitbucket)

Upvotes: 1

Related Questions