Should Gemfile.lock be included in .gitignore?
Simple answer in the year 2021:
Gemfile.lock should be in the version control also for Rubygems. The accepted answer is now 11 years old.
Some reasoning here (cherry-picked from comments):
@josevalim https://github.com/heartcombo/devise/pull/3147#issuecomment-52193788
The Gemfile.lock should stay in the repository because contributors and developers should be able to fork the project and run it using versions that are guaranteed to work.
@rafaelfranca https://github.com/rails/rails/pull/18951#issuecomment-74888396
I don't think it is a good idea to ignore the lock file even for plugins.
This mean that a "git clone; bundle; rake test" sequence is not guarantee to be passing because one of yours dozens of dependencies were upgraded and made your code break. Also, as @chancancode said, it make a lot harder to bisect.
Also Rails has Gemfile.lock in git:
- https://github.com/rails/rails/commit/0ad6d27643057f2eccfe8351409a75a6d1bbb9d0
Gemfile.lock not checked in - Heroku
Found the answer at - http://www.unityisplural.com/2010/11/hobo-finally.html
Why won't Heroku accept my Gemfile.lock in Windows?
Like matt commented above:
The problem is that Bundler creates different Gemfile.lock
s for Windows. The only solution is to create and commit the lock file on a *NIX system.
I would suggest to create a virtual machine running e.g. Ubuntu – maybe using Virtual Box. You can even get ready-to-use virtual machines – for example here.
Cannot push to Heroku (gemfile.lock issue)
The answer was deceptively simple (of course):
git push staging staging:master
The issue was that I was on the staging
branch and needed to update my Heroku staging server's master
branch.
Shame on me for overlooking something so obvious!
... and shame on Heroku's decidedly unhelpful output.
Bundler: You are trying to install in deployment mode after changing your Gemfile
The error message you're getting regarding Gemfile.lock
may be because your Gemfile
and Gemfile.lock
don't agree with each other. It sounds like you've changed something in your Gemfile since you last ran bundle install
(or update
). When you bundle install
, it updates your Gemfile.lock with any changes you've made to Gemfile.
Make sure you run bundle install
locally, and check-in to source control your newly updated Gemfile.lock
after that. Then try deploying.
Edit: As recognised in the comments, a conditional in the Gemfile resulted in a valid Gemfile.lock on one platform, invalid on another. Providing a :platform flag for these platform-dependent gems in the Gemfile should solve the asymmetry.
Related Topics
How to Copy an Object with Presigned Url
Using Watir to Check for Bad Links
What Is the Ruby Equivalent of the "This" Function in Java
Creating a Gmail Draft with Recipients Through Gmail API
How to Programmatically Convert Mp3 to an Itunes-Playable Aac/M4A File
Error Building Ruby in Sublime Text Editor
How to Ssh Interactive Session
How to Convert PDF to Excel or CSV in Rails 4
Ruby: Any Gems for Threadpooling
Ruby Optionparser Empty Switch "-" Behavior
Ruby Outputting to the Same Line as the Previous Output
Unexpected Value of _Callee_ When Including a Module - Is This a Ruby Bug
Ruby Enterprise Edition VS Ruby 1.9
Argumenterror: Wrong Number of Arguments (1 for 2)
What's the Nature of "Property" in a Ruby Class
Rails Format Validation -- Alphanumeric, But Not Purely Numeric