We know the 15 diatonic scales.
Each has a key signature.
G has one sharp in its diatonic scale and the same sharp in its key signature.
The diatonic scales are matched to their key signatures below.
Sharp notes enter in order F#, C#, G#, D#, A#, E#, B#. You remember this sequence from the diatonic scales. Flats enter in mirror order Bb Eb Ab Db Gb Cb Fb.
C# is the key signature of 7 sharps.
Cover the right most sharp.
You now have the key signature of F# (6 sharps).
Cover two sharps to the right.
You now have the key signature of B (5 sharps).
Now start with a clean stave (no key signature). A sharp on F# is the key signature of G. Another sharp over C# changes the key signature to D. Keep adding sharps in this sequence to change the key signature.
Key signatures are building blocks to each other.
Flat key signatures change height but otherwise stay constant through all clefs. They change height to match the names of the notes. Bb is middle line of the treble clef and second space up on the alto clef.
Sharp key signatures similarly change height through the treble, bass and alto clefs. On the tenor clef the standard pattern won't fit. The pattern is mirrored so all sharps in the pattern can fit on the clef.