I’d rather not discuss Git submodules because I heard from several people that they are bad news. I haven’t used them so can’t comment.
In your case you might want to do two things:
- Self-host a private Hex repository.
- Put your common code there as a library.
I gathered from your post that you don’t want that common code to be public so this likely the solution you are looking for?