These are reasons why your mountain bike is creaking:
You should check everything on a regular basis and do complete tune-up once per year. Maintenance of mountain bikes is important because they tend to wear out sooner than expected, as they are subjected to all kinds of harsh weather and rough terrains.
You should clean your bike at least once a year and more often if it is very muddy or got caught in the rain. I clean mine when there is a shifting or braking issue.
You can change gears to keep pedaling at the same cadence in changing environment. It would help if you switched to lower gear when going uphill, and higher gear going down.