Was CTAN the first software repository?
CTAN was preceded by the Aston Archive, as reported in several TUGboat articles:
"A UK-Based TeX Mail Archive Server", by Peter Abbott, November 1988
"UKTeX and the Aston Archive", by Peter Abbott, April 1989
"UKTeX and the Aston Archive", by Peter Abbott, July 1989
"The UKTeX Archive at the University of Aston", by Peter Abbott, November 1989
However, as noted in the answer by @vonbrand, DECUS was almost certainly earlier in having a formal software distribution mechanism, on tape. TeX was part of this collection, as reported in TUGboat:
- "The DECUS TeX Collection". by M. Edward Nieland, November 1989, pp.195-196
Several followup reports appear in later TUGboat issues.
TeX was an active topic at DECUS meetings; this is the earliest report:
- "TeX at the 1981 Spring DECUS U. S. symposium", by Patrick Milligan, July 1981, p.29
I can't say whether the UKTeX archive was inspired by other software projects, but it was clearly something that was needed, and initiated to meet that need.
The early Linux distributions had a sort of package repositories (e.g. Slackware). Earlier you could get sources for Linux-hacked stuff on some places (forget details, that was 1992 or so for me).
Earliest repositories (source) were e.g. the GNU mirrors (starting around 1985 or so), public FTP (and gopher) sites were plenty by 1990 (and probably much, much older). Binary packages were not popular, due to wild differences in architecture/operating system/setup common in the '80s. A common way to share sources (for non-Internet connected sites in the '80s) were Usenet groups like comp.sources.unix (got my first version of Perl as thirty-something posts you had to unpack an stitch together just right, configure by futzing in Makefile macros and then --hopefully-- build.
First mention of software sharing I've seen documented was the custom of dropping off tapes with interesting stuff at DECUS (DEC User group) conferences, and pick them up with a compilation of everything contributed at the end. I believe IBM users had something similar going too. This was in the '70s or even earlier (sorry, away on vacation, no access to my computer now).