IIRC when Google Code was announced to be closing, the Microsoft equivalent (CodePlex) was the next location a lot of projects moved to. It had a decent UI and supported Mercurial in addition to Git.
When MS also announced they were closing that and offering a tool to migrate to GitHub, was when GitHub (and Git) truly became the biggest remaining option.
The other aspect of SourceForge's decline was that they doubled down on the sketchy site feeling right as acceptance of such sites was on the decline, the likes of mediafire, zippyshare etc were being replaced with cloud storage providers and download aggregators were losing popularity (in part due to also becoming very sketchy and prone to pushing malware). They might've been able to get away with it a few years earlier. I remember that back then it wasn't a huge deal to follow a mediafire download link from somewhere that seemed reliable enough, whereas nowadays it'd be an immediate red flag due to the abundance of more legitimate seeming file sharing options.
My recollection is that google code had been dead for a number of years when somebody remembered it was still a thing and then shut it off in 2016.
Google was already using GitHub ("To meet developers where they are, we ourselves migrated nearly a thousand of our own open source projects from Google Code to GitHub.") and added an "export to GiHub" button on google code. Maybe if you were .net you went to codeplex but most everyone else (including Google) went to GitHub, if they weren't already there.
People used Codeplex? I thought it was just this crazy halfstep Sam Ramji convinced MS to take, leading them to open source. When it launched, Codeplex was supposed to be a source code museum, where you could see the code but not reuse it. Crazy I know, but it was what MS was comfortable with at the time, and a few years later they opened .NET. Codeplex was like an experiment to get MS to touch open source code and feel comfortable with it at a legal level, not a replacement for Sourceforge...
Around those times I was mostly a .NET kid and most of the .NET projects I remember looking at were on CodePlex, so maybe my perspective is a little distorted.
Your perspective is in my experience not distorted. Programming is not a unique culture, but divided into multiple subcultures. Projects that were nearer to the .NET or Windows programming culture indeed often chose CodePlex instead of GitHub while there was a choice.
GitHub won well before because git was superior to existing open source SCM solutions and GitHub created Pull Requests which made forking and contributing code back from your fork trivial.
The only real question at the time was whether Git or Mercurial (or for a brief period of time Bazaar if I remember correctly). While Mercurial itself was clearly superior to Git, it had no equivalent to GitHub.
If GitHub had chosen to build their workflows on Mercurial instead we would likely be talking about HgHub right now instead.
>IIRC when Google Code was announced to be closing
That happened in 2015. Everyone was already on GitHub by then. GitHub had surpassed in usage Sourceforge, Code, and CodePlex from 2011. Also CodePlex didn't had Git support until 2012.
I used Google code. Then it announced it's closure either Google code or GitHub provided tools to import projects in to GitHub. I can't remember which. But I did that.
When MS also announced they were closing that and offering a tool to migrate to GitHub, was when GitHub (and Git) truly became the biggest remaining option.
The other aspect of SourceForge's decline was that they doubled down on the sketchy site feeling right as acceptance of such sites was on the decline, the likes of mediafire, zippyshare etc were being replaced with cloud storage providers and download aggregators were losing popularity (in part due to also becoming very sketchy and prone to pushing malware). They might've been able to get away with it a few years earlier. I remember that back then it wasn't a huge deal to follow a mediafire download link from somewhere that seemed reliable enough, whereas nowadays it'd be an immediate red flag due to the abundance of more legitimate seeming file sharing options.