Side stitch is from a lack of training. Ride more. You could also try either not eating before the ride, or eating no less than 2 hours before the ride. You could also try doing some ab work. Chest stitch is from extended periods of heavy breathing. Sometimes that is hydration related, but more usually just lack of extended hard climbing or long speed intervals. Basically, don't worry about it, just ride more.