Sourceforge's downfall was not finding a better business model than advertising – which has devolved into the worst kind of spammy ads. GitHub, on the other hand, has a solid business model that doesn't involve advertising. In fact, putting ads on the site would be suicide.
Sourceforge tried to find a better business model -- sourceforge enterprise edition -- but then spun it off and then sold it to a different company (CollabNet) in 2007...then over the next 3-5 years, laid off almost everyone behind sourceforge.net/OSDN. The only thing left of the company now is thinkgeek.