If you’ve set up a Git ‘Push to Deploy’ setup for your site based on my earlier post, you may or may not have run into some anomalous behaviour! Namely, when you run git submodule init, you get a message similar to this:
No submodule mapping found in .gitmodules for path 'js/jquery-browser-fingerprint'
Or even :
fatal: reference is not a tree: 48d1407779fb1e8dc6d3c6c6fb87df4c1cbc65ed Unable to checkout '48d1407779fb1e8dc6d3c6c6fb87df4c1cbc65ed' in submodule path 'cms/js/flipswitch'
Thankfully, these issues are easily fixed. modules should be listed in a file in your root .gitmodules, and look like this:
[submodule "jquery-browser-fingerprint"] path = /js/jquery-browser-fingerprint url = git://github.com/carlo/jquery-browser-fingerprint.git
Listing your submodules in here will fix your first problem. The second issue is caused by referencing a commit that hasn’t been pushed! Did you copy project files from somewhere else? Try pushing the commit from your other project.
A clearer way to sort these issues however, is to clear whatever cache git has for those submodules. Typing this clears it.
git rm --cached js/jquery-browser-fingerprint
This should allow you to run git submodule init, and git submodule update. One last point. You don’t remember ever having to create this .gitmodules file before, so why now? Basically it allows you to set custom folders etc for the submodule. If you’re happy with the defaults, you should theoretically be able to skip the submodules file, and can combine both git commands into this:
git submodule update --init
This updates everything and initialises in one! So to sum up, try removing the cached stuff in git, then run the combined update init file! Happy pushing, pulling, and deploying!