heroku: Gemfile.lock is required issue
Asked Answered
C

8

14

I have the following issue:

I'm trying to deploy my project on heroku but after i run

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?

The branch i'm trying to push is cloned from master.

Cooperman answered 7/3, 2012 at 16:56 Comment(0)
R
23

Few things

  1. Did you placed Gemfile.lock in git? if yes, is it lock (means updated? - you did several times just double check)
  2. Just do bundle install on your local prompt.
  3. now place Gemfile.lock
    • git add . or you can add only Gemfile.lock with this git add Gemfile.lock
    • git commit -m "commit message here"
    • git push

Now do git push heroku it should work.

Riel answered 7/3, 2012 at 17:19 Comment(1)
Ok, First remove Gemfile.lock from Heroku and github and place new one, Can you come to the chat? - chat.stackoverflow.com we can chatRiel
D
7

On your development machine run rm -rf .bundle && bundle install && git add Gemfile.lock && git commit -m "Added Gemfile.lock" Then deploy.

Democratic answered 26/7, 2012 at 11:28 Comment(0)
L
5

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.

Lupus answered 7/3, 2012 at 17:1 Comment(1)
i've checked it, this file is in my commit. used git ls-files to check thisCooperman
D
3

Check your .gitignore file, if you put Gemfile.lock there, get rid of that line and run this commands:

git add Gemfile.lock
git commit -m "Added Gemfile.lock"
git push
git push heroku
Dioptrics answered 5/5, 2013 at 14:21 Comment(0)
A
0

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.

Alfi answered 7/3, 2012 at 17:1 Comment(0)
I
0

I had this problem, I forgot the bundle install

After it and git & Heroku everything went OK
Don't forget either the 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

Indulgence answered 26/7, 2013 at 7:48 Comment(0)
T
0

Just remove the /Gemfile.lock from your .gitignore

Teofilateosinte answered 3/4, 2016 at 15:11 Comment(0)
P
0

You also need to check your .hgignore file as well and remove the line Gemfile.lock

Pituitary answered 28/8, 2019 at 5:34 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.