Garlic is not likely to be effective as a rat repellent.
Garlic Repellent Theory
Garlic contains several different sulfur compounds that give the plant its characteristically pungent aroma and spicy taste. It is believed that the strong smell and taste of garlic is unpleasant enough to make some animals avoid garden crops and homes.
Garlic Repellent Products
Commercial pest repellents listing garlic extracts as an active ingredient include, but are not limited to, Garlic Barrier™, Garlic Pharm™, Gempler's Garlic Oil Repellent™ and Equimins Garlic & Parsley Oil ™. Most commercial garlic repellents are marketed for use as insect, bird, deer and rabbit repellents. None of these products specifically claim to be effective against rats.
Garlic Repellent Research
Research on the use of garlic as an animal repellent has given mixed results. For example, two studies published by the USDA suggest that garlic oil applied to crops can be used as a taste repellent for birds, while a third USDA study found that treating pine branches with garlic oil provided no protection against porcupines. In addition, an article published by the University of California reports that garlic is ineffective in repelling gophers.
Are Rats Repelled by Garlic?
If rats have an aversion to garlic, it is likely to be very short-lived. Laboratory rats have been used extensively in studies testing the effects of garlic in the diet and pet care sites like the Rat Fan Club recommend adding garlic to rat diets to protect against disease.
Natural Rat Control
According to the University of California Integrated Pest Management Program, the safest and most effective ways to control rats are trapping and good housekeeping.