1) look at his environment. Does he see hitting on tv? in movies? other kids?
2) Tell him what you DO want: take his hands in yours and tell him "hands are for holding, or patting gently".
3) If he does it in excitement, channel it a little. Tell him to give you a "high Five" - a great alternative to hitting.
4) Never hit back or threaten to. You are the adult, the model of good behavior, and that is very confusing to a child.
5) If he does it when upset, teach him a few signs for what he needs - water, food, help... When he is a bit older you can tell him "We use our words".
6) It is normal to have to remind and teach him over and over again - expect that so you won't feel so frustrated or worse - punitive.
Hope that helps! My first boy had limited exposure to other boys and he never hit and was gentle (although spirited).
My nephews taught my youngest boy to hit for fun, and I really had to work with him. Using respect and calm teaching, I succeeded.