Rats can be a common problem in gardens. They can gnaw their way through your fruit and vegetables; set up camp in your compost; and burrow tunnel networks in your soil.

WATCH: How to get rid of rats inside the house

It may be tempting to use traps or poison, but they can pose a risk for dogs, children and native wildlife. It's better to employ methods that deter rats and offer a permanent solution.

Here are six ways to rid your garden of pesky rats for good.

1. Peppermint oil

Rats hate the smell of peppermint oil, so it's an effective way to drive them away. Moisten some cotton balls with 100 per cent pure peppermint oil and place them in various spots around the garden, including the garage and shed. Reapply the oil a couple of times a week.

2. Catnip

Get some catnip from a garden centre and plant it in several spots around the garden. Be strategic with your planting and look for signs of rat activity like nests and pellet droppings.

Catnip in a cottage garden

Getty

3. Remove food and water sources

Rats will seek out any sources of food or water in your garden. Make sure your taps aren't dripping and don't use a bird bath. Remove bowls of pet food or water at night. If you like to compost, keep it secure and bury any organic material deep in the bin. Make sure lids are tightly closed on bins and don't leave garbage bags outside for long periods.

4. Keep your garden clean

You can deter rats by keeping your garden clean and tidy. Remove piles of wood and garden clippings; pick up any fallen fruit, berries or vegetables, and cut back overgrown areas.

Tidy garden with raised garden beds

Getty

5. Soil netting

If you want to protect a new garden from rats, lay a piece of netting just under the soil. This will prevent rats from burrowing and eating roots and bulbs. Determined rats may chew through the netting, so keep an eye out for it.

6. Sealing gaps

Rats will try to enter your home through any gaps or cracks in external walls. Use an appropriate sealant to block any nooks and crannies.

Need to get rid of more pests?

How to make a DIY mouse trap using a bucket