What space shuttle mission repaired the HST?

There have been 5 total HST Servicing Missions, though SM1 is the only one considered a "Repair" mission as well. I was privileged to work on all but the final one.

NASA preferred to use either Discovery or Endeavour for repairs since they have larger bays and can hold more equipment. The missions were:

First Servicing/Repair Mission - SM-1/1993: STS-61 - Biggest repair was COSTAR, the corrective optics that compensated for the mirror flaw. I worked on the electronics for it.

Second Servicing Mission - SM-2/1997 - STS-82 - Added STIS, NICMOS camera, Solid State Recorder (where today's SSD technology came from), Fine Guidance Sensor, and electronic upgrades. I worked on a LOT of stuff for that mission, including new tools used to service it.

Third Servicing Mission - SM-3A/1999 - STS-103 - Originally designed to be just one mission, SM3 was split into two separate missions after it was determined within a few months of mission launch that 3 of HST's 4 gyros had failed. HST's gyros are essential for telescope pointing and maintaining control during observations; without them, HST is essentially space junk.

A quick gyro replacement mission was called up, and most of the equipment slated for installation on the original mission had to wait until 3B.

A bit of trivia on the 3rd mission; originally, mission patches and decals were made showing just the original SM3 mission and insignia. It was later changed to 2 separate missions with different designations, crew, and insignia, so if you ever run across the original, it's a collector's item. I still have several SM3 decals from before the mission change.

Fourth Servicing Mission - SM-3B/2002 - STS-109 - Installed the NICMOS Cooling System and associated hardware, Advanced Camera for Surveys, and other items. The NCS program took a lot of my time, and was the last major HST program I worked on. You can see pics of it on my bio page.

Fifth Servicing Mission - SM-4/2009 - STS-125 - Installed Cosmic Origins Spectograph and Wide-Field Camera 3, the replacement for the WFPC (Wide Field Planetary Camera) installed on SM-2. Repairs to STIS and the ACS were also performed.

For more info, see the NASA link below.