Rails 3/ Git/ Bundler Fatal 无法解析对象
尝试捆绑安装时,我收到以下错误
Fatal could not parse object '8c11dd........
Git error: command git reset --hard '8c11dd
If this error persists you can try removing the cache directory.
已删除缓存目录但没有成功,以前有人见过此错误吗?
Windows 7 64 位
When attempting bundle install I recieve the following error
Fatal could not parse object '8c11dd........
Git error: command git reset --hard '8c11dd
If this error persists you can try removing the cache directory.
Have removed the cache directory with no success, has anyone seen this error before?
Windows 7 64-bit
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(9)
当我跨服务器移动存储库时遇到了同样的错误。通过删除 Gemfile.lock 并运行
bundle install
解决了这个问题。这生成了更新的 Gemfile.lock,有助于解决错误。Ran into the same error when I moved repositories across servers. Resolved it by deleting the Gemfile.lock and running
bundle install
. This generated an updated Gemfile.lock that helped resolve the error.如果您使用 Capistrano,删除(共享/)缓存副本应该可以解决问题。
If you are using Capistrano removing the (shared/)cached-copy should solve the problem.
这里的许多海报都是正确的,因为它很可能与由于存储库移动或重新定位而导致 Gemfile.lock 不同步有关,但正如其他人指出的那样,删除它并不是一个明智的决定。检查 Gemfile.lock 并找到相关存储库的 GIT 条目。要检查的重要事情是它指向的修订元数据属性...它很可能指向不再存在的错误修订哈希。
我的建议是手动编辑它,通过与实际 Repo 的日志文件交叉引用来指向您想要下拉的分支(这样您就可以确保它与实际 Gemfile 中的实际一致),如下所示:
Many of the posters here are correct in that it has most likely has to do with the Gemfile.lock being out of sync due to a repository moving or relocating, but like others pointed out, deleting it isn't a wise decision. Inspect the Gemfile.lock and find a GIT entry for the repo in question. The important thing to check is what the
revision
metadata attribute it points to... It is most likely pointing to a bad revision hash that no longer exists.My advice is to manually edit it to point to the branch that you want to pull down by cross-referencing it with actual Repo's logfile (so you make sure it's consistent with the one that's actually in your actual Gemfile) as follows:
存储库肯定发生了什么事。就我而言,它已被删除/移动。所以我只是更改了 git url。
如果您的
:git =>
指向 github,那么访问该 github 项目的页面可能是个好主意。Something must've happened to the repository. In my case it was removed/moved. So I just changed the
git
url.If your
:git =>
is pointing to github, might be a good idea to visit that github project's page.当我切换到存储库的不同 github 分支时,我在使用
set :deploy_via, :remote_cache
时遇到了与 Capistrano 相同的问题。我的 capistrano 配方指向新的 fork,但远程服务器上的缓存仍然有指向旧存储库的
origin
,因此它没有找到我推送到新 fork 的新提交。通过在每个远程服务器上执行来修复:
git Remote set-url origin <新分支>
I've had the same problem with Capistrano using
set :deploy_via, :remote_cache
when I've switched to different github fork of repository.My capistrano recipe was pointing to new fork, but cache on remote servers was still having
origin
pointing to old repository, and therefore it was not finding new commits I've pushed to new fork.Fixed by executing on each of the remote servers:
git remote set-url origin <new fork>
当发生诸如强制推送到 Gemfile 中引用的 git 存储库之类的更改时,就会出现此问题。
解决方案是在 Gemfile 中注释该 gem 行,运行捆绑包,取消注释并再次捆绑。然后 Gemfile.lock 将引用有效的 git 修订版。
我想这也会有帮助:
捆绑更新 my_gem_name
This problem occurs when there have been changes like force-pushes to a git repo which is referenced in a Gemfile.
The solution is is to comment that gem line in Gemfile, run bundle, uncomment it and bundle again. Then the Gemfile.lock will reference a valid git revision.
I guess it will help too:
bundle update my_gem_name
就我而言,我用于 gem 的 git 分支已合并到 master 中,并且该分支被删除。更新我的
Gemfile
、删除Gemfile.lock
并重新运行bundle
为我解决了这个问题。In my case the git branch that I was using for a gem had been merged into master and the branch deleted. Updating my
Gemfile
, removingGemfile.lock
, and re-runningbundle
solved it for me.您可以将“--source”标志与“bundle update”一起使用。所以它将是:
bundle update --source your_gem
You may use the '--source' flag with 'bundle update'. So it will be:
bundle update --source your_gem
我目前正在构建一个宝石,问题与其他答案有点不同。
我以
Gemfile
中的特定版本为目标,但出于开发目的,我更改了bundle config
以获取本地版本。我在本地计算机上设置了不同的版本,这使得Gemfile.lock
的目标是specs
中的其他内容。该文件是通过 git 通过服务器发送的,服务器显然无法访问该版本的 gem ...
要修复它,只需在 gem 中根据您的版本指定一个
VERSION
即可正在发展/推进,应该没问题。I'm currently building a gem and the problem was a little different from the other answers.
I target a specific version in the
Gemfile
but for development purpose I changed thebundle config
to get the local version. I setup a different version on my local machine which makes theGemfile.lock
target something else in thespecs
.This file is sent through the server via git and the server obviously can't access such version of the gem ...
To fix it, just specify a
VERSION
in your gem accordingly to the one you're developping / pushing on and it should be fine.