Bundler could not find compatible versions for gem "railties":

Hello,
Just getting going on Rails... I have been working through Michael
Hartl's tutorial and things were going good till I suddenly got the
error below when deploying to Heroku.
Before this I had deployed number of times successfully. Locally via
localhost things work fine.... I can see there is a dependency
mismatch but I can't figure out how to solve it or what caused it.

I have the same problem. Here is an attempt to recreate the steps that
caused it for me:

    Platform Windows 7 x64
    - installed latest git (1.7.8.msysgit.0)
    - installed RailsInstaller (ruby 1.9.3)
    - installed DevKit
    - installed Heroku tools w/o Git

I also have cygwin installed (not sure that is relevant but there have
been issues with mingw32 apps). After installing all of the above I did
the following:

     - Ran "gems update"
     - Followed Rails Tutorial exactly

The tutorial process failed at the step for pushing to Heroku with error
shown in the original question. I tried to work around the problem:

    * Tried changing Gemfile back to "~> " versions
    * Deleted extra local versions of installed railsties and
sass-rails, reinstalled only the specified versions
    * Tried using sass-rails 3.2.4 in Gemfile in hopes the dependency
would correct itself

Nothing worked. Sometimes a local "bundle update"/"bundle install" would
work, sometimes it would fail. It seemed to always work from a git bash
window and cmd.exe failed most of the time. But no matter what the
outcome locally, when I tried to push to Heroku it always gave the
error message above.

Rubygems.org clearly shows that the sass-rails dependency on railties
should be on 3.2.0.beta so something funky is going on. Just wish I knew
what it is.

Also a first-timer working through the tutorial so not sure this is
right way but it worked for me.

1. Ran gem update
2. Changed gemfile in your project root to add the '~> ' for sass-rails,
coffee-rails and jquery-rails to appear as follows:

"
gem 'rails', '3.2.1'
...
group :assets do
  gem 'sass-rails', '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.2'
...
gem 'jquery-rails', '~> 2.0.0'
"

3. git commit -a -m "updating gemfile for heroku"
4. git push heroku master

As I say, not necessarily right answer but worked on my side. Hope it
helps.

Thanks for the recipe.

I thought I'd tried that combination before but it had failed. This time
it worked. Either something new in 'gems update' changed things or I
neglected to do the commit for this particular combination.

Either way, thanks for getting me up and running again.

I am first time user and struggling with heroku deployment. Your
solution worked for me. Thanks.