I recommend you have a look at this:
To summarize the salient points, there are three safe methods of preserving garlic at home:
- Drying (dehydrating)
- Pickling (storing in wine or vinegar)
Note that "preparing" garlic in acid is not pickling. It has to be stored that way; the botulism spores cannot grow in acid, but they will not necessarily be killed either. Also note that you'll eventually see mold with this method (much sooner at room temperature). Anyway, this doesn't involve any oil, so it is probably not what you want.
Making the oil and then removing the garlic is also clearly not a solution here; the bacteria and spores can very easily migrate from the garlic to the oil in less time than it takes you to actually infuse any flavour.
It is true that cooking garlic to 121° C / 250° F for no less than 3 minutes will kill all of the bacteria and spores, but this will also kill most of the flavour, and even then, it's difficult (actually, it's impossible without a lab) to be certain that you were successful - and that's assuming it doesn't get recontaminated on its way to the jar.
Garlic is a low-acid food and the oil provides an anaerobic environment. Combined with room or even refrigerator temperatures, this is precisely the environment that C.botulinum bacteria and spores grow best in. Even if you manage to kill it all, you then have to take steps to prevent recontamination.
Commercially-bottled garlic in oil is not only pressure-canned to guarantee immediate safety, but also has strong acids (i.e. phosphoric) and usually some other preservatives added in order to prevent any future contamination. And even then, they generally recommend that it be stored in the refrigerator, not at room temperature.
If you are experienced with home pressure canning (and I cannot emphasize the word experienced enough here) then you could probably use a method similar to that of pickling peppers; the risks are about the same (peppers are also low-acid), and you are acidifying the mixture at the same time as the canning. This, obviously, will affect the flavour, but it will be reasonably safe. And again, home-canned vegetables should always be stored in the refrigerator, never at room temperature.
Another option is to dry the garlic first, then store it in the oil. The bacteria need water (not oil) to survive and multiply, so if the moisture level is down to 6% or lower, the risk of contamination is extremely low. As mentioned above, you can use this method at home; the downside is of course that dried garlic won't infuse as well, but at least it won't have a pickled/acid taste.
So in a nutshell, your options for making garlic oil at home are either (a) don't do it, (b) dehydrate the garlic first, or (c) pressure-can it with an acid. Of those, I would pick (a), but if you're dead-set on following through with this, then make sure you follow the instructions very carefully.