1.
Take Polytheism as your first research goal. Eighty percent of the time on all difficulty levels Prince and up on a normal sized map with seven opponents, this will give you Hinduism. If you play on lower difficulties your chances are better; if you play on bigger maps with more opponents they're worse. But you always have a good chance, though no guarantee.
2. After getting Polytheism, Bronze Working, and Archery, research Priesthood and build the Oracle. Chop as necessary. While building the Oracle, research Writing. Make sure you get Writing before you finish the Oracle; finish the Oracle as soon after that as possible. Get OB treaties with all civs you've encountered as soon as you get Writing! Take CoL as your free tech, this will give you Confucianism. I have never had this fail.
Even if you get Hinduism in step 1,
playing as the HRE you still want to do step 2, because it opens your UB. Also, two religion shrines are better than one.

Choose which of the religions to adopt as SR (or a third one founded by someone else) for diplomatic advantage, naturally.