7

I'm having trouble with this Git issue and I cannot seem to resolve it.

I have a node that I've been building and I've finally reached the point of deploying it.

I'm trying to push files directly to my app on Heroku. I know that I can simply pull the data from a Github repo but I'd like to avoid having my private keys public, obviously, so I created a custom module for the keys to be accessed (e.g., "modules/private-variables.js"). This file is included in the .gitignore so I don't push it to my Github, which is publicly viewable.

When it came time to push my app to Heroku, for whatever reason I can not push that file specifically.

git add -f modules/private-variables.js

For whatever reason this is not working. It's still replying that "Everything is up-to-date"

$ 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've ran "heroku run bash" and concluded that my file was still not there.

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

Any helpful tips would be much appreciated.

Piece Digital
  • 161
  • 1
  • 10

1 Answers1

6

I was able to solve this on my own after some time.

The issue was that I was using a different branch to push to Heroku. See, as I said before I'm still lacking in knowledge of how Git works.

I thought that when I did...

$ git push heroku master

... while on my branch "deploy" I would simply be pushing the files currently present.

I now know that this is not the case. I have to push the "deploy" branch to "master" on Heroku.

According to this answer: https://stackoverflow.com/a/11143639/4107851

I have to do "git push heroku [name of branch to push]:master

$ git push heroku deploy:master

I haven't tried this exact method yet. I simply went back to my master branch, included the ignored file, and pushed it up to Heroku. Now that I know this about Git I'm sure this'll make future development much easier (and less of a headache).

You learn something new everyday. :)

Community
  • 1
  • 1
Piece Digital
  • 161
  • 1
  • 10