Cannot force commit file to Heroku

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.

  • Is it possible to revoke commits?
  • Enabling auto-completion in git bash on windows?
  • How do I list branches that have been pushed to a remote?
  • How to re-base a forked repo when doing a merge request - Gitlab
  • Git: how to update the working directory like hg up -C in Mercurial
  • Golang: Executing a command with it's arguments
  • 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.

  • Ignoring funny ref
  • 'Go Get' Private Repo from Bitbucket
  • heroku-like workflow on personal server
  • How to find the branch for a commitId in git?
  • Merge or Rebase or Branch Default In Android Studio? What are the differences?
  • Why is git looking inside vendors directory?
  • One Solution collect form web for “Cannot force commit file to Heroku”

    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:

    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. 🙂

    Git Baby is a git and github fan, let's start git clone.