Gemfile.lock
is included into .gitignore
. It is an agreement between developers, and it should remain so. Is there a way to push code to Heroku? Or may be you suggest some Ruby hosting which does not use Git to deploy an app?

- 25,812
- 38
- 124
- 247
2 Answers
To push it to Heroku, you'll have to add it to your repo. Why don't you want to commit it? It's recommended to commit Gemfile.lock in your repo (unless you're developing a gem):
When developing an app, check in your Gemfile.lock, since you will use the bundler tool across all machines, and the precision enforced by bundler is extremely desirable for applications.

- 398,885
- 90
- 523
- 479
-
This file is constantly updating and making the developers angry. We all have to run `bundle update`. Why Heroku can't? Let's say, it could be a user's choice in config options whether to require `Gemfile.lock` or not. (It is more a suggestion to Heroku). – Paul Apr 17 '14 at 05:30
So, currently we are doing the things in a following way:
- Our Git repository doesn't store
Gemfile.lock
- When we need to push to Heroku, we make a copy of project folder
- remove in a copy
origin
remote to prevent accidental pushes to our Git, leavingheroku
only, - make a commit which includes
Gemfile.lock
- and push the copy to Heroku.
Then, if we need some live debugging on Heroku in special cases, we leave the copy folder undeleted, copying changed files to it from the main folder and making small commits to publish them on Heroku.
If we need to do a final publication:
- we make one big commit in a main directory,
- make a clean copy of main directory, with all the changes,
- make an additional commit to include
Gemfile.lock
- push the copy with "force" key to Heroku.
This prevents us from a bunch of small debugging commits in our Git repository.
Some of us have a Windows batch file to publish automatically:
@echo off
rmdir /s /q heroku
xcopy /E /H our-app-folder heroku\
cd heroku
git remote remove origin
git add .
git add --force Gemfile.lock
git commit -m "Heroku push"
SET HOME=%HOMEDRIVE%%HOMEPATH%
git push heroku master -f
cmd /c heroku pg:reset DATABASE --confirm heroku-app-name
cmd /c heroku run rake db:migrate
cmd /c heroku run rake db:seed
cmd /c heroku restart
pause
All this we need to do because Heroku supports publishing through Git only.

- 25,812
- 38
- 124
- 247