我已经使用rbenv
一段时间用于ruby,我对跟踪的文件没有任何问题;一切似乎都在它的位置,我还没有真正的问题。
我最近切换到rvm
以获取新项目,并且不得不将一些内容更改为我的环境。因此,每当我运行bundle
时,添加到我的项目中的所有宝石都会通过git进行跟踪,看起来像这样;
new file: vendor/bundle/ruby/2.2.0/bin/aws-rb
new file: vendor/bundle/ruby/2.2.0/bin/byebug
new file: vendor/bundle/ruby/2.2.0/bin/erubis
new file: vendor/bundle/ruby/2.2.0/bin/geocode
new file: vendor/bundle/ruby/2.2.0/bin/nokogiri
new file: vendor/bundle/ruby/2.2.0/bin/rackup
new file: vendor/bundle/ruby/2.2.0/bin/rails
new file: vendor/bundle/ruby/2.2.0/bin/rake
new file: vendor/bundle/ruby/2.2.0/bin/rdoc
new file: vendor/bundle/ruby/2.2.0/bin/ri
new file: vendor/bundle/ruby/2.2.0/bin/sass
new file: vendor/bundle/ruby/2.2.0/bin/sass-convert
new file: vendor/bundle/ruby/2.2.0/bin/scss
new file: vendor/bundle/ruby/2.2.0/bin/sdoc
new file: vendor/bundle/ruby/2.2.0/bin/sdoc-merge
new file: vendor/bundle/ruby/2.2.0/bin/spring
new file: vendor/bundle/ruby/2.2.0/bin/sprockets
new file: vendor/bundle/ruby/2.2.0/bin/thor
new file: vendor/bundle/ruby/2.2.0/bin/tilt
new file: vendor/bundle/ruby/2.2.0/bin/unicorn
new file: vendor/bundle/ruby/2.2.0/bin/unicorn_rails
new file: vendor/bundle/ruby/2.2.0/cache/actionmailer-4.2.6.gem
new file: vendor/bundle/ruby/2.2.0/cache/actionpack-4.2.6.gem
new file: vendor/bundle/ruby/2.2.0/cache/actionview-4.2.6.gem
new file: vendor/bundle/ruby/2.2.0/cache/activejob-4.2.6.gem
new file: vendor/bundle/ruby/2.2.0/cache/activemodel-4.2.6.gem
new file: vendor/bundle/ruby/2.2.0/cache/activerecord-4.2.6.gem
new file: vendor/bundle/ruby/2.2.0/cache/activesupport-4.2.6.gem
因此,github没有显示我的全部提交,我的git add
需要永久保留,总体来说它非常混乱。
使用rbenv
我没有遇到此问题,所以我只能假设它与我设置rvm
的方式有关。这是我目前的bash_profile
# Set architecture flags
export ARCHFLAGS="-arch x86_64"
# Ensure user-installed binaries take precedence
export PATH=/usr/local/bin:/usr/local/sbin:$PATH
# RBENV - add bin and shims to path
export PATH=$HOME/.rbenv/bin:$PATH
eval "$(rbenv init -)"
# Bash completion
if [ -f $(brew --prefix)/etc/bash_completion ]; then
. $(brew --prefix)/etc/bash_completion
fi
# Git completion
if [ -f ~/.git-completion.bash ]; then
source ~/.git-completion.bash
fi
# Aliases
alias b="bundle exec"
alias t="RAILS_ENV=test"
alias bi="bundle install; rbenv rehash"
alias bu="bundle update; rbenv rehash"
# message from RVM (5/2/16)
# first attempt below
#source /Users/username/.rvm/scripts/rvm
# next attempt below
source ~/.rvm/scripts/rvm
我认为目前的跟踪是由于我的路径设置如何,这是我目前所不了解的。
我想知道是否有人有过这方面的经验,如果他们能告诉我如何阻止我从git跟踪下载的所有宝石。任何帮助将不胜感激:)
这是我的.bundle/config
文件
---
BUNDLE_PATH: vendor/bundle
BUNDLE_DISABLE_SHARED_GEMS: true
这里是rvm env
export PATH="/Users/username/.rvm/gems/ruby-2.2.3/bin:/Users/username/.rvm/gems/ruby-2.2.3@global/bin:/Users/username/.rvm/rubies/ruby-2.2.3/bin:$PATH"
export GEM_HOME='/Users/username/.rvm/gems/ruby-2.2.3'
export GEM_PATH='/Users/username/.rvm/gems/ruby-2.2.3:/Users/username/.rvm/gems/ruby-2.2.3@global'
export MY_RUBY_HOME='/Users/username/.rvm/rubies/ruby-2.2.3'
export IRBRC='/Users/username/.rvm/rubies/ruby-2.2.3/.irbrc'
unset MAGLEV_HOME
unset RBXOPT
export RUBY_VERSION='ruby-2.2.3'
这里是which ruby
/Users/username/.rvm/rubies/ruby-2.2.3/bin/ruby
答案 0 :(得分:0)
您应该添加.gitignore
文件。
答案 1 :(得分:0)
你必须删除.bundle / config(这是一个覆盖你的用户偏好的每个项目配置)。
确保使用正确的Ruby版本($rvm list rubies
将显示当前路径中使用的当前Ruby版本)
如果您正在为项目使用所需的Ruby版本,那么您应该为此Ruby版本安装了bundler gem,它应该可以工作。