If you want to get rid of flies (and other nasty creatures such as cockroaches in your cabinets) and use ingredients you probably already have at home, here's what you do:
1 cup of water
A few drops of dish soap
15-20 cloves of garlic (it may seem like a lot but it works.)
First, put the water and the dish soap together in a small bowl. Add the chopped garlic and mix until the mixture is well combined. Then transfer this to a spray bottle.
Afterward, wipe down all surfaces throughout your cabinets with the homemade fly repellent solution to kill any insects that are hiding there. You can also spray it on plants, or fruit trees near your garden if you suspect bugs are living around there too.