Which ligament? Your knee has 2 that run down the sides (medial and lateral), two that form a cross in the middle (anterior and posterior cruciate) and the patellar ligament below the kneecap.
I've partially torn both the ACL and the medial one (several times), and I knew quite a few people who tore their ACL completely (and one who tore his PCL) when playing American football. Recovery time depends on which ligament it is, what sort of surgery you had, and also personal healing ability. The good news is that cycling (initially indoors) is one of the processes encouraged during recovery, so long as you stay seated and can get on/off the bike OK. If you haven't already, get referred to an orthapedic physio to oversee your recovery - they will be able to give you a much better idea of how fast you can recover than anyone on the internet.
My partially torn ACL had me off football for about 5 months, but it's the twisting and landing from jumps that carries the risk, so cycling would have been much sooner. The fully torn and replaced ACL guys took about a year to come back (to football), but the surgery has improved a fair bit in the last 10 years. The PCL guy had to quit playing football, because PCL surgery lags behind as it's much more rare.
I don't know anyone who tore their patellar ligament.
Don't worry about losing fitness - you'll pick it up again pretty quickly, and by the time your knee is properly healed you won't be far off what you had before.
Good luck with your recovery.