git heroku:Gemfile.lock 是必需的问题
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9605863/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
heroku: Gemfile.lock is required issue
提问by roman
I have the following issue:
我有以下问题:
I'm trying to deploy my project on heroku but after i run
我正在尝试在 heroku 上部署我的项目,但在我运行之后
git push heroku master
I get the following:
我得到以下信息:
git push heroku master -f
Counting objects: 524, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (498/498), done.
Writing objects: 100% (524/524), 157.76 KiB, done.
Total 524 (delta 207), reused 62 (delta 2)
-----> 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
To [email protected]:*****.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to '[email protected]:*****.git'
I have run bundle install
and bundle update
for several times, i tried to delete Gemfile.lock
from the repository and from my filesystem. But i still get the same message. Can anyone tell me what am i doing wrong?
我已经运行bundle install
和bundle update
几次,我试图删除Gemfile.lock
从资源库中,并从我的文件系统。但我仍然收到相同的消息。谁能告诉我我做错了什么?
The branch i'm trying to push is cloned from master.
我试图推送的分支是从 master 克隆的。
回答by AMIC MING
Few things
几样东西
- Did you placed Gemfile.lock in git? if yes, is it lock (means updated? - you did several times just double check)
- Just do
bundle install
on your local prompt. - now place Gemfile.lock
git add .
or you can add only Gemfile.lock with thisgit add Gemfile.lock
- git commit -m "commit message here"
- git push
- 你把 Gemfile.lock 放在 git 中了吗?如果是,它是否锁定(意味着更新? - 你做了几次只是仔细检查)
- 只需按照
bundle install
您的本地提示操作即可。 - 现在放置 Gemfile.lock
git add .
或者你可以只添加 Gemfile.lockgit add Gemfile.lock
- git commit -m "在此处提交消息"
- 推
Now do git push heroku
it should work.
现在做git push heroku
它应该工作。
回答by entropyftw
On your development machine run
rm -rf .bundle && bundle install && git add Gemfile.lock && git commit -m "Added Gemfile.lock"
Then deploy.
在您的开发机器上运行
rm -rf .bundle && bundle install && git add Gemfile.lock && git commit -m "Added Gemfile.lock"
然后部署。
回答by Veraticus
Most likely your Gemfile.lock is not committed to your repository. Use git st
and ensure that the Gemfile.lock is committed; check your .gitignore file to make sure that you're not accidentally ignoring it.
很可能您的 Gemfile.lock 没有提交到您的存储库。使用git st
并确保 Gemfile.lock 已提交;检查您的 .gitignore 文件以确保您没有意外忽略它。
回答by Saeed
Check your .gitignore file, if you put Gemfile.lock there, get rid of that line and run this commands:
检查您的 .gitignore 文件,如果您将 Gemfile.lock 放在那里,请删除该行并运行以下命令:
git add Gemfile.lock
git commit -m "Added Gemfile.lock"
git push
git push heroku
回答by Gregtheitroade Mulliez
I had this problem, I forgot the bundle install
我有这个问题,我忘记了 bundle install
After it and git & Heroku everything went OK
Don't forget either the git remote
在它和 git & Heroku 之后一切顺利
不要忘记git remote
after writing your code the sequence would be :
编写代码后,序列将是:
bundle install
heroku create
git init
git add *
git remote
git commit -a -m "First init"
git push heroku master
I think it's complete
我认为它是完整的
回答by HasanAboShally
Just remove the /Gemfile.lock
from your .gitignore
只需/Gemfile.lock
从您的 .gitignore 中删除
回答by Sudeep Ghimiray
You also need to check your .hgignore file as well and remove the line Gemfile.lock
您还需要检查您的 .hgignore 文件并删除 Gemfile.lock 行
回答by John Beynon
It's telling you that you need to push a Gemfile.lock - that's how Heroku knows what versions of gems your application is using. After bundling locally, commit the resultant Gemfile.lock then push the application to Heroku.
它告诉你你需要推送一个 Gemfile.lock - 这就是 Heroku 知道你的应用程序正在使用的 gems 版本的方式。在本地捆绑后,提交生成的 Gemfile.lock,然后将应用程序推送到 Heroku。