Build a small fence around your garden to keep groundhogs out
The most effective way to keep groundhogs out of a garden is to erect a small fence around it, where possible. The fence can be a simple design of wire mesh and posts, at least 3 feet high with a foot of wobbly mesh at the top to make climbing difficult. Groundhogs can also tunnel under fences—to prevent this sink the fencing 12 inches below ground, then bend it outward (away from the garden) for 12 more inches to create an “L” shape, then fill dirt in on top of the underground fencing.
Scare groundhogs away from your garden
When the affected plants are not in a garden or where fencing is impractical, place unfamiliar visual stimuli around the plants, such as beach balls, shiny pinwheels, or mylar balloons. Groundhogs are timid creatures and are nervous of new stimuli in their environment.
Another technique is to install a motion-sensitive sprinkler near the area where the groundhog is eating plants. These devices (one popular one is called the Scarecrow, which can be purchased at some hardware stores) will spray any animal that comes near the site with an unpleasant stream of water.
Never relocate groundhogs
Never relocate groundhogs as this is harmful to the animals and does not address the source of the problem.