KirstensAmazing
KirstensAmazing

Reputation: 123

git submodule referencing SHA that doesn't exist

I took the following files from rcbops:

https://github.com/rcbops/chef-cookbooks

I moved them internally, copying all of the cookbooks over.

I then edited the .gitmodules file to point to my local repos.

Between the time that I uploaded the repos internally, and the time I tested my code, the external repos were updated. (Particularly Rabbitmq).

After running my command to download the submodules. I get the following error:

fatal: reference is not a tree: c04c57b549c2b79f2df5922aad3a27769234bf5c
Unable to checkout 'c04c57b549c2b79f2df5922aad3a27769234bf5c' in submodule path 'cookbooks/rabbitmq'

From what it looks like, it looks like it is referencing an external SHA, but looking on my local repos for that SHA.

How can I fix this?

Upvotes: 2

Views: 2517

Answers (2)

Rory G
Rory G

Reputation: 172

git submodule update --remote -f [module name]

This will update your submodule to the head

Upvotes: 0

VonC
VonC

Reputation: 1324073

Changing the .gitmodule might not be enough.

A git submodule update might be necessary as well.

Check then content of the parent repo:

  • .git/config to see if the submodule "chef-cookbooks" url has been changed
  • and cd .git/modules/chef-cookbooks: see if git remote -v is empty or points to your own submodule repo.

Upvotes: 1

Related Questions