IMO Microsoft views GitHub's user base as potential Azure leads and Cloud computing as the current & future lucrative computing utilization business model who has been pulling out all stops to grow Azure as fast as possible.
They're fortunately rich & big enough that they don't need every one of their business to maximize their profits and are more than happy to leverage the synergies in their different assets to funnel more business into Azure.