簡體   English   中英

捆綁安裝不起作用-拒絕Git權限

[英]Bundle Install not working - Git permission denied

我嘗試使用終端命令“ Rails S”在本地服務器上運行Ruby on Rails應用程序,但隨后我被要求將所有gem捆綁安裝到此筆記本電腦上-Osx

這是終端輸出:

Johns-MacBook-Pro-2:spu-test JohnSmith$ rails s
Could not find coffee-rails-4.0.1 in any of the sources
Run `bundle install` to install missing gems.
Johns-MacBook-Pro-2:spu-test JohnSmith$ bundle install
Fetching gem metadata from https://rubygems.org/
Fetching version metadata from https://rubygems.org/
Fetching dependency metadata from https://rubygems.org/
error: cannot open .git/FETCH_HEAD: Permission denied

Retrying git fetch --force --quiet --tags "/Users/JohnSmith/.bundle/cache/git/active_admin-d67faab65e9b74efbc8efb4a777a851e9f78b2ca" due to error (2/4): Bundler::Source::Git::GitCommandError Git error: command `git fetch --force --quiet --tags "/Users/JohnSmith/.bundle/cache/git/active_admin-d67faab65e9b74efbc8efb4a777a851e9f78b2ca"` in directory /Library/Ruby/Gems/2.0.0/bundler/gems/active_admin-3d7605f82706 has failed.
If this error persists you could try removing the cache directory '/Users/JohnSmith/.bundle/cache/git/active_admin-d67faab65e9b74efbc8efb4a777a851e9f78b2ca'
error: cannot open .git/FETCH_HEAD: Permission denied

Retrying git fetch --force --quiet --tags "/Users/JohnSmith/.bundle/cache/git/active_admin-d67faab65e9b74efbc8efb4a777a851e9f78b2ca" due to error (3/4): Bundler::Source::Git::GitCommandError Git error: command `git fetch --force --quiet --tags "/Users/JohnSmith/.bundle/cache/git/active_admin-d67faab65e9b74efbc8efb4a777a851e9f78b2ca"` in directory /Library/Ruby/Gems/2.0.0/bundler/gems/active_admin-3d7605f82706 has failed.
If this error persists you could try removing the cache directory '/Users/JohnSmith/.bundle/cache/git/active_admin-d67faab65e9b74efbc8efb4a777a851e9f78b2ca'
error: cannot open .git/FETCH_HEAD: Permission denied

Retrying git fetch --force --quiet --tags "/Users/JohnSmith/.bundle/cache/git/active_admin-d67faab65e9b74efbc8efb4a777a851e9f78b2ca" due to error (4/4): Bundler::Source::Git::GitCommandError Git error: command `git fetch --force --quiet --tags "/Users/JohnSmith/.bundle/cache/git/active_admin-d67faab65e9b74efbc8efb4a777a851e9f78b2ca"` in directory /Library/Ruby/Gems/2.0.0/bundler/gems/active_admin-3d7605f82706 has failed.
If this error persists you could try removing the cache directory '/Users/JohnSmith/.bundle/cache/git/active_admin-d67faab65e9b74efbc8efb4a777a851e9f78b2ca'
error: cannot open .git/FETCH_HEAD: Permission denied

Git error: command `git fetch --force --quiet --tags
"/Users/JohnSmith/.bundle/cache/git/active_admin-d67faab65e9b74efbc8efb4a777a851e9f78b2ca"`
in directory /Library/Ruby/Gems/2.0.0/bundler/gems/active_admin-3d7605f82706 has
failed.
If this error persists you could try removing the cache directory
'/Users/JohnSmith/.bundle/cache/git/active_admin-d67faab65e9b74efbc8efb4a777a851e9f78b2ca'
Johns-MacBook-Pro-2:spu-test JohnSmith$

刪除緩存目錄后,使用sudo bundle install會出錯:

Johns-MacBook-Pro-2:spu-test JohnSmith$ sudo bundle install
Password:
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and
installing your bundle as root will break this application for all non-root
users on this machine.
Fetching gem metadata from https://rubygems.org/
Fetching version metadata from https://rubygems.org/
Fetching dependency metadata from https://rubygems.org/
Rubygems 2.0.14.1 is not threadsafe, so your gems will be installed one at a time. Upgrade to Rubygems 2.1.0 or higher to enable parallel gem installation.
Using rake 10.3.2
Using Ascii85 1.0.2
Using i18n 0.6.9
Using minitest 4.7.5
Using multi_json 1.10.1
Using thread_safe 0.3.4
Using tzinfo 0.3.39
Using builder 3.1.4
Using erubis 2.7.0
Using rack 1.5.2
Using mime-types 1.25.1
Using polyglot 0.3.5
Using sass 3.2.19
Using thor 0.19.1
Using coffee-script-source 1.7.0
Using execjs 2.1.0
Using activerecord-deprecated_finders 1.0.3
Using arel 4.0.2
Using bundler 1.12.5
Using hike 1.2.3
Using tilt 1.4.1
Using addressable 2.3.6
Using afm 0.2.1
Using aws_cf_signer 0.1.3
Using bcrypt 3.1.7
Using cancan 2.0.0.alpha from git://github.com/ryanb/cancan.git (at 2.0@e6bf4c8)
Using json 1.8.1
Using orm_adapter 0.5.0
Using excon 0.42.0
Using geocoder 1.2.4
Using gmaps4rails 2.1.2
Using hashery 2.1.1
Using pdf-core 0.1.6
Using ruby-rc4 0.1.5
Using ttfunk 1.1.1
Installing pg 0.17.1 with native extensions

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

    /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
checking for pg_config... yes
Using config values from /usr/local/bin/pg_config
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for pg_config_manual.h... yes
checking for PQconnectdb() in -lpq... no
checking for PQconnectdb() in -llibpq... no
checking for PQconnectdb() in -lms/libpq... no
Can't find the PostgreSQL client library (libpq)
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
    --with-pg
    --without-pg
    --with-pg-config
    --without-pg-config
    --with-pg_config
    --without-pg_config
    --with-pg-dir
    --without-pg-dir
    --with-pg-include
    --without-pg-include=${pg-dir}/include
    --with-pg-lib
    --without-pg-lib=${pg-dir}/
    --with-pqlib
    --without-pqlib
    --with-libpqlib
    --without-libpqlib
    --with-ms/libpqlib
    --without-ms/libpqlib


Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/pg-0.17.1 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/gems/pg-0.17.1/ext/gem_make.out
Using rails3_serve_static_assets 0.0.1 from git://github.com/heroku/rails3_serve_static_assets.git (at master@84910ce)
Using rails_log_stdout 0.0.1 from git://github.com/heroku/rails_log_stdout.git (at master@f9a9275)
Using underscore-rails 1.6.0
Using will_paginate 3.0.5
Using activesupport 4.0.5
Using rack-test 0.6.2
Using warden 1.2.3
Using rest-client 1.6.7
Using treetop 1.4.15
Using bourbon 3.2.3
Using coffee-script 2.2.0
Using sprockets 2.11.0
Using rdoc 4.1.1
Using uglifier 2.5.0
Using mandrill-api 1.0.53
Using pdf-reader 1.3.3
Using prawn 0.15.0
An error occurred while installing pg (0.17.1), and Bundler cannot continue.
Make sure that `gem install pg -v '0.17.1'` succeeds before bundling.

我遇到了同樣的問題,並像這樣修復了它。

  1. 備份當前的.bundle和供應商目錄
  2. 然后刪除兩個目錄
  3. 運行bundle clean --force
  4. 最后,運行bundle install --path vendor/cache

捆綁安裝--path供應商/緩存

您的問題將得到解決。 :)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM