rajn
rajn

Reputation: 178

creating and deployment of application on heroku

I am new to heroku and I am trying to create an app and deploy, but when i do heroku create on CLI this creates a random name for the application. So I used heroku app:create project-name which created the application with the project-name but how do i deploy my existing code to that application.

Upvotes: 0

Views: 671

Answers (2)

John Beynon
John Beynon

Reputation: 37507

If you've already performed heroku create without specifying a name in your application folder then you will already have a git remote named heroku. You can confirm this by doing

git remote -v 

in your project folder which will probably show something like

heroku  [email protected]:stark-taiga-7738.git (fetch)
heroku  [email protected]:stark-taiga-7738.git (push)

When you then create an application specifying an application name then the existing remote will not get updated with the new application details.

To fix this you will need to remove the existing git remote named heroku and then add a new one pointed to the correct application.

git remote rm heroku will remove the existing remote

heroku git:remote --app <new app name> will create a new heroku remote pointing at your new application will then let you do git push heroku master and deploy to the correct application.

Upvotes: 1

Vidya
Vidya

Reputation: 30310

Heroku uses Git to deploy. Navigate to the home directory of your application and simply do

git push heroku master

See the documentation for deploying a node.js application to Heroku for details.

Upvotes: 0

Related Questions