Midnight Commander doesn't have that sort of control over subdirectory operations. Kind of an 'all or none' type deal. Like you said, you can control the top level entries, but nothing more.
I suppose you could write some sort of script to be used in the F2 menu...
Another way, kinda of kludgy, but would work...
find . -type d -name ".git" -exec chmod 000 "{}" \;
Which would make all the .git subdirectories unreadable, MC would pop up an error dialog, tell it 'Continue' and keep processing.
Afterwards:
find . -type d -name ".git" -exec chmod 750 "{}" \;
to restore the desired permissions. (I use 750 & 640 myself, many prefer 755 & 644... use whatever you prefer in place of the '750' there)
Ha! and as a blending of my 'put it in the F2 menu' idea... you could put THOSE two commands in the F2 menu... making this almost (almost!) painless.
EDIT:
By request:
#
# Restore permissions for any .git subdirectories to 755
g Restore .git directories to 755 permissions
if [ "x$PWD" = "x$HOME" ]; then
exit
fi
find . -type d -name ".git" -exec chmod 755 "{}" \; 2>/dev/null
#
# Remove permissions for any .git subdirectories
G Hide .git directories with 000 permissions
if [ "x$PWD" = "x$HOME" ]; then
exit
fi
find . -type d -name ".git" -exec chmod 000 "{}" \; 2>/dev/null
#
Save this into file '~/.config/mc/menu'
If this file already exists, append it to the END (certain things must be first in the file, don't want to mess that up).
If this file did not exist, then the entries here will REPLACE all the default F2/User menu entries which were normally seen. If you need those menu entries back (some are handy!), then find the file named mc.menu (usually found in /etc/mc/), copy it to ~/.config/mc/menu, and again, append the above to the end. THE END!
If you're using an older version of mc, you may need to search for the mc.menu file, and the menu file needs to be in ~/.mc.menu ... complicated, yes, a bit. But recently, mc revised their config file locations to reflect best practices (XDG suggestions) and moved everything to ~/.config/mc/. The mc(1) man page is very helpful, search for user menu.
This adds two commands:
g (lowercase g) which will RESTORE the 755 permissions for any .git subdirs
G (uppercase g) which will REMOVE the permissions (set to 000) from any .git subdirs
I added a test to prevent performing this in your $HOME, although this isn't destructive... it just didn't sit well being able to do that there.
Enjoy!