E Minor and G Major have the same notes so which of these you are playing in depends upon what the highest and lowest notes of your tune are or where the passage comes to a rest (on the E or G), the natural resting place of a passage is called it's tonic note. E minor and G major are said to be different Modes of the same key, that is to say that they contain the same notes but start at different places. Sometimes it's not clear which mode one is playing in because the melody spans more than one octave. Confused? You will be, there are tons of threads on this site about modes and they don't seem to come to anything but a vague consensus. Still, hope this helped.
If I couldn't laugh at myself how could I laugh at someone less ridiculous?