Explore Courses Blog Tutorials Interview Questions
0 votes
in DevOps and Agile by (19.4k points)

I have a project with a submodule that is pointing to an invalid commit: the submodule commit remained local and when I try to fetch it from another repo I get:

$ git submodule update

fatal: reference is not a tree: 2d7cfbd09fc96c04c4c41148d44ed7778add6b43

Unable to checkout '2d7cfbd09fc96c04c4c41148d44ed7778add6b43' in submodule path 'mysubmodule'

I know what the submodule HEAD should be, is there any way I can change this locally, without pushing from the repo that does have commit 2d7cfbd09fc96c04c4c41148d44ed7778add6b43?

1 Answer

0 votes
by (27.5k points)

Let us first talk about why this could occur in the first place:

A. Submodule(s) have been edited in place.

B. Submodule(s) committed, which updates the hash of the submodule that is being pointed to.

C. Submodule(s) not pushed.find exact fixing commit or version.

Solution for this problem would to perform push after modifying the submodule

$ cd submodule

$ git push

Related questions

Browse Categories