All good advise by Hardy, however, just had a look at a spare alternator, note the key slot in the gear is not machined parallel with the taper on the shaft, it is parallel with the centre line of the shaft, IE, the slot is deeper at the front of the gear than it is at the back.
This means, if the key is a tight fit in slot (which they seem to be) and not set at the right angle, the gear jams on it before seating on the taper. This is what had happened on mine. Wouldn't mind but Mr Hamfist knew it wasn't seating and smothered the shaft, gear and bolt with loctite and hoped it would be OK. I could hear the noise it was making under the cases but didn't know what was causing it. Loctite was the clue.
Clean the slot sides and ease the sides of the key until it is a light press fit in the slot and able to swivel when pressed on either end. It will then find its correct angle as the gear is pressed on. Would second hardy's idea to mark the shaft with gear position before inserting the key.
Here's another picture showing where back of gear had jammed on key and marked it. Wonder how long it had been running like that ?
Brian