Can add Gemfile and Gemfile.lock in git

I am trying to deploy my application to Heroku. I removed the "sqlite3" stone and added the following part to my Gemfile:

gem 'sqlite3', group: :development

group :production do
    gem 'pg'
    gem 'rails_12factor'
end

After that, I installed the package for the update. However, when I try to do git add, he said:

error: insufficient permission for adding an object to repository database.git/objects
error: Gemfile.lock: failed to insert into database
error: unable to index file Gemfile.lock
fatal: updating files failed

If I remove the code that I added to the Gemfile, everything works fine! I work on OSX 10.11.1, Rails 4.2.4, ruby ​​2.2.1p85 and git 2.4.9 (Apple Git -60).

+4
source share
2 answers

The problem is probably due to the fact that your config / database.yml needs to be configured to use postgresql instead of sqlite.

postgres , gem 'sqlite3', group: :development gemfile gem 'pg' ( : dev, prod test).

.yml default: &default :

  adapter: postgresql

, sqlite dev, production: .yml :

production:
  adapter: postgresql
  encoding: unicode
  pool: 5

database: :

  database: your_app_name_production

"your_app_name" - .

. , YAML .

, .

+1

- Gemfile.lock.

( , ). git rm Gemfile.lock. Gemfile.lock , , , .

, bundle install, .

a git add -A ( , git add *).

+1

Source: https://habr.com/ru/post/1613980/


All Articles