"Bundle install" error: cannot open .git / FETCH_HEAD: permission denied

I recently changed my ubuntu to Linux mint so I need to reinstall my gems but it gives me this error ....

The steps I took

  • Generated pub / private keys and added to github.
  • re run command "bundle install" but doesn't work.

Fetching git://github.com/seuros/capistrano-puma.git
error: cannot open .git/FETCH_HEAD: Permission denied

Retrying git fetch --force --quiet --tags 


"/home/asad/.bundler/cache/git/capistrano-puma-e90ae8bdcca081264c0ff67caa1d11e89f7a01e0" due to error (2/3): Bundler::Source::Git::GitCommandError Git error: command `git fetch --force --quiet --tags "/home/asad/.bundler/cache/git/capistrano-puma-e90ae8bdcca081264c0ff67caa1d11e89f7a01e0"` in directory /usr/local/rvm/gems/ruby-2.0.0-p598/bundler/gems/capistrano-puma-7748efb9a53d has failed.
        If this error persists you could try removing the cache directory '/home/asad/.bundler/cache/git/capistrano-puma-e90ae8bdcca081264c0ff67caa1d11e89f7a01e0'
        error: cannot open .git/FETCH_HEAD: Permission denied

        Retrying git fetch --force --quiet --tags "/home/asad/.bundler/cache/git/capistrano-puma-e90ae8bdcca081264c0ff67caa1d11e89f7a01e0" due to error (3/3): Bundler::Source::Git::GitCommandError Git error: command `git fetch --force --quiet --tags "/home/asad/.bundler/cache/git/capistrano-puma-e90ae8bdcca081264c0ff67caa1d11e89f7a01e0"` in directory /usr/local/rvm/gems/ruby-2.0.0-p598/bundler/gems/capistrano-puma-7748efb9a53d has failed.
        If this error persists you could try removing the cache directory '/home/asad/.bundler/cache/git/capistrano-puma-e90ae8bdcca081264c0ff67caa1d11e89f7a01e0'
        error: cannot open .git/FETCH_HEAD: Permission denied

        Git error: command `git fetch --force --quiet --tags "/home/asad/.bundler/cache/git/capistrano-puma-e90ae8bdcca081264c0ff67caa1d11e89f7a01e0"` in directory
        /usr/local/rvm/gems/ruby-2.0.0-p598/bundler/gems/capistrano-puma-7748efb9a53d has failed.
        If this error persists you could try removing the cache directory '/home/asad/.bundler/cache/git/capistrano-puma-e90ae8bdcca081264c0ff67caa1d11e89f7a01e0'

      

+3


source to share


6 answers


If you are using rvm

, from the command line run:

~> rvm fix-permissions

      



This solved this error for me.

+6


source


I had the same issue while updating bundler ... it turns out that the cache directory at the installation location of the bundler system is causing the problem. Cleaning up completely fixes the problem - it was on OSX, not RVM, but standard OSX ruby ​​on 10.10.3



0


source


bundle exec bundle install

      

worked for me. I made a mistake installing ruby ​​when I was logged in as root, so I have to do it now until I fix the problem.

0


source


Try it, it worked for me.

rm Gemfile.lock

      

0


source


In my case, I am using rbenv

and have faced the same problem so far bundle install

.

Cause

when cloning rbenv

from my repo, I was unclearly using sudo

like

sudo git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build

      

This means that the sudo

owner of the directory and other users do not have permission to access the repo.

Decision

I don't know if this is the best way to solve this problem; excuse me

I changed directory permission ~/.rbenv

sudo chmod 777 ~/.rbenv/**

      

0


source


Well .. this is not the best answer, but:

sudo bundle install

      

-five


source







All Articles