We uncovered an issue where fastlane complains that Gemfile.lock is modified and dirty, so cannot deploy. The error message looks like this:
[06:55:45]: Found unexpected uncommited changes in the working directory. Expected these files to have changed: user.xcodeproj/project.pbxproj user/Supporting Files/Info.plist user/Supporting Files/Info.plist. But found these actual changes: Gemfile.lock. Make sure you have cleaned up the build artifacts and are only left with the changed version files at this stage in your lane, and don't touch the working directory while your lane is running. You can also use the :force option to bypass this check, and always commit a version bump regardless of the state of the working directory.
We were able to track down the issue to https://github.com/bundler/bundler/issues/3697.
In summary, bundler will update Gemfile.lock when you are using different version of bundler. The user was using 1.10.6 to create Gemfile.lock but Circle uses 1.7.4 to bundle install. In this situation, running bundler exec or install makes the dirty file.
The workaround is installing the latest bundler with
sudo gem install bundler.
Credits: originally posted by @kimh