Please be very careful and do not overdo your guitar practice.  Allow yourself regular breaks (at least one every half hour) and if you feel any pain at all please, please stop practicing immediately.  You might just need to give your hands and fingers a rest for a while (say 10 minutes or half an hour) or there might be a more serious problem with your technique or playing posture.  Most pain subsides when you rest but if not you should seek advice from a guitar teacher or posture specialist. 

Sometimes you can sort out posture problems by yourself, simply by looking in a mirror while you play and finding the problem via observation.  If something about the way you are sitting and holding the guitar looks awkward, then it probably isn't good for you. 

It can also be helpful to study how professional guitarists hold their guitars but it is important to realise that what works for other players might not be best for you.  Everyone is built differently and there is no single solution that works for everyone. 

I am not a qualified expert in this area but I have survived by observation and knowing when to stop.  If there is a problem, try to change what you are doing and if possible avoid situations that cause pain.

Also it's worth noting that while many young guitarists can play with bad posture and not experience any pain, serious problems can and most probably will develop later in life.  For that reason it's a great idea to sort out postural problems early on and to always be aware of what you are doing.

My name might be Paine but it is best to avoid Pain!