Instead of harsh pesticides and lethal traps, some people turn to nature to repel gophers from their gardens. Although there is no definitive scientific evidence that plants successfully repel gophers, some gardeners have claimed limited success. The plants that may be somewhat effective tend to have a pungent smell and bitter taste, and many are poisonous. Having just one or two of these plants usually doesn't work; often they must be planted as a barrier around landscapes and gardens, like a living fence.

...
Castor bean plant is used as a gopher repellent.

Onion Family

Anyone using onions in cooking can attest that they're pungent. Onions or anything from the Allium genus are said to repel gophers, and can even be beautiful. Any Allium that forms bulbs can be used, including garlic, shallots and onions. There are some more visually pleasing options, though, such as decorative Alliums. "Purple Sensation" has large balls of purple flowers, "Mount Everest" is white, and Allium moly has pretty yellow flowers atop a long stalk. Hair Allium is more interesting than beautiful; it has twisted green strands emerging from the small flower.

Bulbs

Certain flower bulbs are said to repel gophers. Fortunately they're probably plants you'd be happy to have in your garden even if they did nothing but sit there and be beautiful. Frittillaria imperialis feature a large profile and gorgeous orange or yellow flowers that form on a tall stalk. Daffodils are everyone's long awaited harbinger of spring, and they may help keep your flower beds gopher-free, too. Scilla has pretty, starry lavender or blue flowers on a ball-shaped head, or in flower spikes.

Annuals

Among the annuals is one that's actually called a gopher plant (Euphorbia lathyrus), due to its reputation as a gopher repellent. Its flowers aren't all that appealing but the plant has structural interest with its symmetrical blue-green leaves. It's a prolific reseeder, however. Another plant, castor bean, grows quite large and has pretty, maple-like leaves. It is poisonous, however, and probably shouldn't be grown where children or animals play. Marigolds and hot pepper plants are also said to be gopher repellents.

Trees and Shrubs

Illicium religiosum is a pretty, broadleaved evergreen tree with glossy green leaves and starry white flowers. Sophora angustifolia is a large shrub with racemes of yellow pea-like flowers. These trees usually don't appear on any gopher-repellent plant lists. However, there are formulations patented in the U.S. that use the poisonous roots of these trees in concoctions intended as repellents. The seeds as well as the roots of the Illicium are poisonous, so it's not good for gardens where children play.