简体   繁体   中英

Rails 3/ Git/ Bundler Fatal could not parse object

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

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删除(共享/)缓存副本应解决问题。

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
  remote: https://github.com/YourUserOrOrganization/your-gem-repo.git
  revision: <UPDATE AND FIX ME!>
  specs:
    some-random-dep1 (2.4.3)
      some-random-dep2 (>= 1.7.9)
      some-random-dep3 (>= 1.6.7)

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.

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>

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 , removing Gemfile.lock , and re-running bundle solved it for me.

You may use the '--source' flag with 'bundle update'. So it will be:

bundle update --source your_gem

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

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 the bundle config to get the local version. I setup a different version on my local machine which makes the Gemfile.lock target something else in the specs .

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.

gem "my-gem", git: "https://github.com/Loschcode/my-gem.git", branch: "master", tag: "v0.2.2"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM