Microsoft has announced it is to acquire the code-sharing site Github.

Github, based in San Francisco, is an online platform that allows coders to collaborate with each other on their work.

It is used by employees at many big companies, including Microsoft.

Microsoft said it was paying $7.5bn (£5.6bn) in stock to achieve the deal, which is due to be completed before the end of the year. It said Github would continue to operate independently.

"We recognise 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 challenge," said Microsoft's chief executive Satya Nadella in a statement.

It added that Github is currently used by more than 28 million developers, who in turn represent more than 1.5 million organisations across a range of industries.

The business will be led by Nat Friedman, the founder of Xamarin - a mobile software development service acquired by Microsoft in 2016.

Microsoft described Mr Friedman as being an "open source" veteran.

The term refers to the principle that code is made publicly accessible so that others can inspect, modify and share it.

Microsoft added that Github's current chief executive, Chris Wanstrath, will move elsewhere in its corporation to work on strategic software initiatives.

Github's basic service is free, but it charges a monthly fee of up to $21 per user for extra services including round-the-clock support and the ability to give team members different levels of access.

Takeover worries
"Github offers transparency - it's a very effective, no-fuss tool to run projects globally while allowing many developers to contribute," commented Malcolm Barclay, a UK-based app developer.

"Some are nervous because of what Microsoft has done with past purchases - Skype for example - and the worry is that Github could be destroyed.

"Many of Microsoft's takeovers are driven by user numbers, and Github has a lot of users.

"Presumably it wants something from them, but we don't know what that is."

The BBC is among those to use Github to share some of its open source code.

Microsoft used to run a rival service called Codeplex, but shut it down last year saying that Github had become the "de facto place for open source sharing".

Bloomberg, which had earlier reported a deal would be announced, had noted that Github was last valued in 2015 at $2bn.

Satya's takeovers:

The following are some of the biggest acquisitions made by Microsoft since Mr Nadella took charge in 2014:

Mojang (2014) $2.5bn - Swedish developer of the video game Minecraft

N-trig (2015) $200m - Israeli digital pen company, whose technology is used in Microsoft's Surface Pen

Adallom (2015) $320m - Israeli cloud security start-up

Touchtype (2016) $250m - UK-based artificial intelligence firm behind the Swiftkey predictive keyboard

LinkedIn (2016) $26bn - California-based social network for professionals

AltSpaceVR (2017) undisclosed sum - California-based virtual reality social network

Semantic Machines (2018) undisclosed sum - California-based "conversational AI" developer

Github (2018) $7.5bn - San Francisco-based code-sharing site

One of the beneficiaries of the deal is the venture capital firm Andreessen Horowitz.

It took a $100m stake in the business six years ago - its biggest single investment at that time.

"Where [others] saw us 'overpaying', we saw a once-in-a-decade company," blogged its partner Peter Levine.

"Modern programming is about assembling code... as well as writing it, and code tends to belong in one place where it's easy to access and that place was, is, and will be Github.

"The combination of Microsoft and GitHub is a powerful one and I know that Satya and team understand the incredible opportunity."