Squirrels can be a real nuisance in vegetable gardens when they take nips from pumpkins, squash, tomatoes, etc., Repellent sprays don't work well on vegetables, partly because many impart a bitter or undesirable taste to crops and partly because the plants grow fast, exposing new unsprayed areas to attack. Nor do traps work well, because after some squirrels are removed, the food source in the garden attracts more. Shake-Away™ (powdered fox urine) sprinkled on the ground or fresh fox urine put out in dispensers can work reasonably well for a time-at least until the squirrels deduce that despite the smell there are no foxes-but this should be regarded as a temporary measure.
The best way to keep squirrels and other small animals out of your vegetable garden is with a permanent, inexpensive, electric fence. Mr. McGregor's Fence® Plus will zap critters without hurting them, pets or children. It will work 100% effectively against ground squirrels and if no low tree limbs overhang your garden it will also work 100% effectively against tree squirrels. And besides squirrels it will also keep out woodchucks/ground hogs, raccoons, rabbits, skunks, and opossums."