This lesson explains it well. It shows you where the majors and relative minors fall in a key. The trick to remember is that E to F is a natural semi tone as is B to C. This relationship and where it falls in the key o determines which chords will be sharp or flat. In the Key of C the natural semi tones fall in the right place for them to remain unchanged. The 3-4 intervals and the 7-8 intervals. All other Keys have their chords adjusted to a certain extent to change semi tones to tones and vicea versa. You say you are familiar with the key of G. The tones and one semi tone fits. The F is a problem. E to F is only a semi tone which you can't have at the 6-7 intervals. The F to G is a whole tone in the 7-8 position which again, you can't have. A semi tone only. Notice that making the F into F# now fits the formula. A whole tone between 6-7 and a half tone between 7-8.
You can work them out with a sheet of paper once you know the tone semi formula. You could also memorize the circle of fifths starting with C which will tell you how many # and bs are in each key. You have bitten off quite a large chunk of information to be digested.
You could always just google for a key chart if you want to do it that way. should be easy to find.
The Music Building