Instead of
gem 'rails'
You can specify a github user/repo combination with
gem 'rails', github: 'rails/rails'