Monday, October 24, 2011

[GIT Submodule] Fatal: Reference is not a tree : xxxx

These days, try to use submodule to manage a project. But I got

$ git submodule update fatal: reference is not a tree: ba81b5bf9ffce6b6ec9c50605035ca9dddb50023 Unable to checkout 'ba81b5bf9ffce6b6ec9c50605035ca9dddb50023' in submodule path 'Src/ThermalController' 

The cause of this issue is:

I create the orignal project and add the submodule from remote repo.

Then modified the .gitmodule manual to point a local cache of the remote repo.

Then commit the original project.

I cloned the original project from repo as cloned project.

Here is the working flow:

Update from original project and commit, actually, that is committed to the remote repo.

In cloned project, pull and update the submodule, then I got the error message as above.

That because the local repo is not synced with remote yet.

So the solution is:

1. Try to sync the local/remote repo OR

2. Update the orignal project's submodule to point to the local repo as well as cloned project.

No comments: