why does bundler install fail with a permissions error for git repository sourced gem?
bundle install
just started failing for me (Mac OS X Snow Leopard) on a gem that is sourced from a github repository. It used to work just fine. Here's the error message:
error: insufficient permission for adding an object to repository database ./objects
fatal: failed to write object
fatal: unpack-objects failed
An error has occurred in git when running `git fetch --force --quiet --tags "git://github.com/plataformatec/devise.git" refs/heads/*:refs/heads/*`. Cannot complete bundling.
From the Gemfile, here's the gem line:
gem 'devise', :git => 'git://github.com/plata开发者_开发技巧formatec/devise.git'
I tried "bundle install --system" but that didn't seem to solve the problem either. I can get it to work if I specify a path like "bundle install --path=.bundle/gems" But what I'm trying to figure out is why it used to work, but no longer does.
Where does bundler try to install git repo gems if you specify --system?
Try bundle config
in your application's directory. I'm going to assume that you created a Gemfile without first running bundle init
and that therefore you don't have .bundle/config
containing:
---
BUNDLE_DISABLE_SHARED_GEMS: "1"
Looks like I found my own answer:
Under Snow Leopard repo gems are stored at:
/Library/Ruby/Gems/1.8/cache/bundler/git
It turned out that somehow permissions got munged for the cached devise repo in that directory. To fix the problem all I had to do was sudo remove that repo and re-run bundle install.
精彩评论