When a hen pecks at you, you just take a finger and either tap them on top of the head or give them a quick-little poke. This is kind of an imitation of their pecking-order behavior, and they get the message pretty quick. "Don't peck me--I'm bigger than you and I won't put up with it." Most hens are pretty polite--their rules of etiquette are just a bit different from ours.
As for how to keep a chicken out of the garden... you don't.You can try fencing them out of it, but short of standing guard while they're ranging there's very little way to keep them from paying your peppers a visit or tearing up all of your mulch in search of bugs. One note on keeping chickens out of gardens--I've found that instead of trying to herd or chase them out of the garden, it is far more effective to toss a dirt clod up in the air so that it lands in their general vicinity. This causes a thump and a rustle that is usually enough to encourage the chickens to move out of the vegetable garden and into more open terrain where they can keep an eye out for predators. This encourages them out of your garden without them making a connection between you and something that caused them alarm.
that is cool