问题
My first time pushing to Heroku using Git and I'm getting the error message: Gemfile.lock is required. Please run "bundle install" locally and commit your Gemfile.lock.
I have ran bundle install
, added the files to the git
repo, commited the changes. See the Gemfile.lock
in both the repository and my directory but when I run the command git push heroku master
it consistently throws that error.
What am I doing wrong:
Here is the git repo on my PC
$git ls-files
.bundle/config
.gitignore
.rspec
Gemfile
Gemfile.lock
README
Rakefile
app/assets/images/rails.png
app/assets/javascripts/application.js
app/assets/stylesheets/application.css
..<snip>..
Here is the git status of the repo.
$git status
# On branch ch_ruby_intro
# Your branch is ahead of 'origin/ch_ruby_intro' by 6 commits.
#
nothing to commit (working directory clean)
Error when I try to deploy.
$git push heroku master
Counting objects: 239, done.
Compressing objects: 100% (140/140), done.
Writing objects: 100% (239/239), 50.30 KiB, done.
Total 239 (delta 74), reused 215 (delta 67)
-----> Heroku receiving push
-----> Ruby/Rails app detected
!
! Gemfile.lock is required. Please run "bundle install" locally
! and commit your Gemfile.lock.
!
! Heroku push rejected, failed to compile Ruby/rails app
Why is it not seeing the Gemfile.lock file?
回答1:
Might it be that you're committing to the wrong branch? You're pushing master and committing to ch_ruby_intro.
来源:https://stackoverflow.com/questions/12886044/git-push-heroku-master-will-not-recognize-my-gemfile-lock-file