GitHub's track record on this so far is fantastic. Repos that were created 15 years ago and didn't see another commit since their creation are still there today.
Latest commit in CVS. I'm not sure what the Last Update date is about, but I think Sourceforge did some larger data shuffle in 2013, at least there are many orphaned projects where the site claims an update in 2013 even though nothing of the sort happened.
Downside is GitHub or any of the commercial git-hosting sites might use your code in ways you didn't intend e.g. machine learning, training neural nets, etc. Alternatively they might go out of business and go down after hinting you to save a local copy. These are countered by self-hosting your repo in your own (home/cloud) server.
Downside of self-hosting is time, money and effort. You've to spend for energy and hardware and your time and effort to keep them shipshape. Chances of it surviving beyond you are slim.
Both has downsides; just pick one depending on what kind of person you're. If you only want to write code vs that and also know how to maintain it. The latter is necessary skill if you ask me, instead of being just a code monkey.