hitting help!!!

Ok so my 2 year old was with a babysitter for about 6 months. Not really a home daycare but she watched 3 kids(i guess you could call it an "unlicensed" daycare.) What I didnt realize is said baby sitter "tapped" his hand/bum If he got in trouble for something. I use quotations because I only found out when he had a red mark on his hand when picking him up. We don't use any type of hitting in our household, so that was a big no for me. I pulled him out this was right before covid, so roughly 2ish months ago. Now my issue:

My son hits. If he gets in trouble he will hit you, if you tell him not to, he does it again. I know hes 2, and that this type of stuff might come with the "terrible 2s", but part of me thinks its because he was hit when getting in trouble.

I dont know how to get him to stoppppp . Since being out of the baby sitters, it has probably cut in half to what he used to do, but I just dont know what to do. I tell him to stop and he keeps doing it, if I ignore that he did it, he wont do it again, but will it really help if I ignore him doing it? Anyone who had toddlers that hit? How can i stop it?