Microsoft on Monday announced plans to acquire software developer platform GitHub in a deal valued at $7.5 billion.

GitHub was valued at $2 billion in its last funding round in 2015, though it has yet to turn a profit.

Microsoft has seen its once-dominant Windows unit slip in market share in recent years, spurring a cloud-first reorganization and sending Microsoft looking for alternatives to court developers.

"Microsoft is a developer-first company, and by joining forces with GitHub we strengthen our commitment to developer freedom, openness and innovation," Microsoft CEO Satya Nadella said in a statement. "We recognize the community responsibility we take on with this agreement and will do our best work to empower every developer to build, innovate and solve the world's most pressing challenges."

Microsoft vice president Nat Friedman will assume the role of GitHub CEO, the company said. He takes over for the developer platform's founder Chris Wanstrath, who stepped down 10 months ago.

"The future of software development is bright, and I'm thrilled to be joining forces with Microsoft to help make it a reality," Wanstrath said. "Their focus on developers lines up perfectly with our own, and their scale, tools and global cloud will play a huge role in making GitHub even more valuable for developers everywhere."

GitHub's tools have become essential to software developers, who use it to store code, keep track of updates and discuss issues.

The privately held company has more than 23 million individual users in more than 1.5 million organizations. It was on track to book more than $200 million in subscription revenue, including more than $110 million from companies using its enterprise product, GitHub told CNBC last fall. The platform has been named to CNBC's Disruptor List five times.

GitHub's financials will be reported under Microsoft's Intelligent Cloud segment. The tie-up will "accelerate enterprise use of GitHub and bring Microsoft's developer tools and services to new audiences," Microsoft said.

Microsoft has reportedly flirted with buying GitHub in the past, including in 2016, although GitHub denied those reports. A partnership could give Microsoft another connection point to the developers it needs to court in order to build applications on its various platforms, including the Azure cloud. Microsoft could also use data from GitHub to improve its artificial intelligence products.

Microsoft doesn't expect to make money off the deal until 2020 but said it will have minimal negative impact on earnings.

Talks to acquire GitHub were first reported Friday by Business Insider. The deal is expected to close by the end of 2018, Microsoft said.

—CNBC's Jordan Novet contributed to this story.