Can't force commit file in Heroku

I am having problems with this Git problem and I cannot resolve it.

I have a node that I created, and I finally got to deploying it.

I am trying to transfer files directly to my Heroku application. I know that I can just pull data from the Github repository, but I would like for me not to open my private keys, so I created a custom module for accessing keys (for example, "modules / private-variables". JS "). This file is included in .gitignore, so I don’t click it on my Github, which is publicly viewable.

When it came time to push my application to Heroku, for some reason I cannot directly click this file.

git add -f modules/private-variables.js 

For some reason this does not work. He still answers that "everything is updated"

 $ git add -f modules/private-variables.js $ git commit -m "7th attempt to include necessary file" $ git push heroku master 

I even did "git commit -a"

 $ git add -f modules/private-variables.js $ git commit -a $ git push heroku master 

I ran "heroku run bash" and came to the conclusion that my file still does not exist.

Admittedly, I'm still relatively inexperienced with Git, but this is the first time I tried to include a file that was once in .gitignore, so I never had this problem. I even tried removing one line from .gitignore.

Any helpful tips would be greatly appreciated.

+6
source share
1 answer

I was able to solve this on my own after a while.

The problem was that I used another branch to click on Heroku. See, as I said, I still lack knowledge of how Git works.

I thought when I did this ...

 $ git push heroku master 

... while on my branch "expand" I will just push the files that are currently available.

Now I know that this is not so. I need to click "expand" the "master" branch on Heroku.

According to this answer: fooobar.com/questions/25437 / ...

I need to do git push heroku [branch name for push]: master

 $ git push heroku deploy:master 

I have not tried this exact method yet. I just went back to my main branch, included the ignored file and pushed it to Herok. Now that I know this about Git, I'm sure it will make future development a lot easier (and less of a headache).

You will learn something new every day. :)

+5
source

All Articles