How to keep groundhogs out of the garden
Do you want to go organic, or do you want to destroy the groundhog?
There are really two choices you have when deciding to rid your garden of pests like groundhogs. You can use an organic repellent that will make your garden seem less delicious to these animals, or you can just kill the animal. In some areas you might not be allowed to kill certain garden pests, so you'll have to go the organic route.
Don't use poisons
I usually advise against using poisons in or around your garden, even if you've decided you want to turn your well-maintained garden into a death camp for groundhogs. Poisons can be effective, but they can also end mixed in to areas of the garden where you'd prefer they not be, like on the food you plan on eating. It can also leach into the ground and contaminate ground water. If you know of organic poisons that are effective and consumable by humans, that might be a good alternative.
The organic solution
There are many types of organic products that you can sprinkle on your garden and will repel animals like groundhogs, squirrels, and even rabbits. One such product is made by Messina Wildlife Management, a company that focuses on ways to humanely keep animal pests out of gardens. The video below shows one such product like this in use.
The "other" solution to groundhogs
In some parts of the country, if you live far enough away from your neighbor, you can just go out and shoot a groundhog. Use the safety lessons and common sense you hopefully had before purchasing the weapon when you go out to take care of the groundhog. Another solution involves trapping the groundhog. You can trap and release, but what fun is that? There are many types of animal traps out there that will do the job.
To be honest, trapping can be a royal pain in the behind. You can't guarantee it will be a groundhog that gets caught in there, and it's just plain demoralizing when you're trying to be humane to the groundhog and you end up having to deal with a live skunk instead. If you do happen to trap a skunk, the method I've used is to cover the trap with an old blanket that you don't care about, release it while standing on the other side of the opening, and get the hell out of there until the skunk has moved away from the trap.
If you do end up with a dead animal from a trap or from shooting it, do not discard of the carcass in your compost pile. You should not put any rotting meats in there.