5

I've deployed my directory to Heroku using git push heroku master, but nothing happens.... Everything up-to-date is what the screen reads.

How can I push to Heroku the exact version that I am running locally, since the local version does the things I want?

maudulus
  • 10,627
  • 10
  • 78
  • 117

4 Answers4

3

If you are sure that the source codes itself are not the same in these two branches, you can use force push:

# Make sure you are on your local master branch
git branch
# Make sure that your remote address is correctly set
git remote -v
# Then force push your master branch to heroku remote master branch
git push heroku master -f

force pushing a branch to a remote will force the remote branch to take on the branch’s code and git commit history

But if you don't have access to check the source code, check if Environment Variables are the same on local machine and server or not (e.g. NODE_ENV variable)

Moreover, Double check automatic deployment of heroku (if exists) as well as the node and npm version of both machines and be aware of the command you run on both machines (npm start or node . or ...) that may have different operations based on envs or so.

  • When I do this I get the `Everything up-to-date` message and it doesn't push anything. However, it is still different on the web vs localhost. I've cleared caches etc. – maudulus Sep 19 '18 at 15:20
  • One thing I was wondering is whether there is a way to re-push to Heroku: https://stackoverflow.com/questions/41345744/redeploy-heroku-app-without-code-changes – maudulus Sep 19 '18 at 15:30
  • Are you sure that the source codes of remote branch and local branch are still different? Or only the functionality of server is not the same? – Amir Masud Zare Bidaki Sep 19 '18 at 15:31
  • have you tried purging cache of heroku with https://devcenter.heroku.com/articles/git#build-cache -> https://github.com/heroku/heroku-repo#purge-cache ? – Amir Masud Zare Bidaki Sep 19 '18 at 15:32
  • It's a good idea to clone the remote branch via [heroku cli plugin](https://github.com/heroku/heroku-repo#clone) and investigate for possible differences with local one with `diff -qr dir1/ dir2/` – Amir Masud Zare Bidaki Sep 19 '18 at 15:43
  • @maudulus have you tried to clone the repo from git and then run it locally? (or removing node_modules dir and rerunning npm install) maybe you are using some dependencies that is not saved in `package.json` and it caused this difference :thinking: – Amir Masud Zare Bidaki Sep 19 '18 at 16:00
2

Please check the branch or remote url of heroku.

In heroku click Deploy tab and find out the branch. Add the remote url in your local machine terminal.

1) heroku git:remote -a projectname
2) git status
3) git add .
4) git commit -m "message"
5) git push heroku master
Vikash Dhiman
  • 570
  • 5
  • 16
1

Since you are not doing anything obviously wrong, something is wrong. It is hard to say what it is exactly, without additional investigation.

I suggest that you clone your project from heroku into a new directory, then copy your local changes from your local branch (which as you said works on 3000 port) into this fresh directory and push all those changes as usual:

git add -A
git commit -m "some message"
git push

It is also a good idea to diff fresh clone with your currently working directory. If tracked files are identical, that would suggest difference between local environment and heroku container configuration.

isp-zax
  • 3,833
  • 13
  • 21
0

first run git add -A to stage all changes, including deletions.

or run git add . to stage all changes, without the deletions.

then git push heroku master will push those staged changes to master and remote heroku.

this is because, while no changes were staged, there is nothing to push (both branches identical).

using a visual front-end might help to make it easier to handle. and maybe consider to setup a local staging environment (where the term staging has a different meaning, than it has within the context of git), in order to test properly, before pushing files to the live environment.

Martin Zeitler
  • 1
  • 19
  • 155
  • 216