Viet
Viet

Reputation: 6953

Deploy app to Heroku with custom name using git?

From Heroku's guide, I can only do this:

heroku create

(there will be a Heroku repository with generated name)

git push heroku master

then if I want to rename it (I'll have to anyway), I'll do this:

git remote rename generated-name the-name-i-want

But if I want to create a Heroku repository with a custom name, I can't deploy my code using terminal:

heroku create the-name-i-want

git push heroku master 

throw error

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

or

git push heroku the-name-i-want master

or

git push the-name-i-want master

throw error

fatal: 'the-name-i-want' does not appear to be a git repository
fatal: Could not read from remote repository.

How do you deploy your code to heroku with a custom name, using git? I use Windows 10.

Upvotes: 0

Views: 979

Answers (1)

msanford
msanford

Reputation: 12227

You are conflating two concepts: heroku in the examples is the name of the git remote, not the application.

Let's walk through that: git push heroku master pushes your current branch to the remote called heroku to branch master.

When you heroku create the-name-i-want you still get a git remote called heroku.

When you want to change the remote's name, instead of

git remote rename generated-name the-name-i-want

use

git remote rename heroku the-name-i-want

Then you can

git push the-name-i-want master

That's why you got the error fatal: 'the-name-i-want' does not appear to be a git repository

Check your remote names and URLs with git remote -v.

Upvotes: 3

Related Questions