Hello!
I wouldn’t call it “punishing”, just “teaching” or “training”. When my rooster that I used to have started to attack me, I would push or kick him back with my foot, or sometimes chase him with my arms out like I was going to catch him. He did not like that, and he would always run away...