我第一次使用 Git 推送到 Heroku,我收到了错误消息:Gemfile.lock is required. Please run "bundle install" locally and commit your Gemfile.lock.
我已经运行bundle install
,将文件添加到git
repo,提交了更改。在存储库和我的目录中都可以看到Gemfile.lock
,但是当我运行该命令时git push heroku master
,它始终会抛出该错误。
我究竟做错了什么:
这是我电脑上的 git repo
$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>..
这是 repo 的 git 状态。
$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)
尝试部署时出错。
$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
为什么看不到 Gemfile.lock 文件?