You can keep cats out while not harming them by using a repellent to deter them.
Keep cats out of yard safe for dogs.
Some animals including cats deer dogs rabbits and raccoons can t stand the scent of vinegar even after it has dried.
Watch out for rue some people have a skin allergy to it.
This is an effective deterrent and is not harmful to your dog or the yard.
Bergamot rue and citronella can repel both dogs and cats.
For cats specifically try scaredy cat coleus canina or herbs such as lavender and rosemary.
For dogs potting marigold also called calendula can work.