There is no difference in meaning, though "oh my gosh" is a softer, less offensive version of "oh my god." They are both expressions of surprise, disgust, excitement, etc. People who don't want to use god's name prefer to say "oh my gosh" but the meaning is exactly the same. "Oh, my God" is slightly rude.