A lot of people recommend graphite for squeaky door hinges. Does graphite work? Yes it does, it will stop the squeak. The drawback is that graphite is a black powder and it can make quite a mess if it gets on something like your carpet or painted walls. Graphite can work its way out of the hinge and stain things. So for door hinges, I do not recommend graphite.
The two best choices are a silicone spray or white lithium grease. My preference it the silicone spray. It is colorless and can be used sparingly. You may have to use it more often than grease, but it is less messy and a little easier to use. Purchase a spray can of silicone spray, one that is suitable for door hardware. It should have one of those long red tubes taped to the side of the can.
You can also use white lithium grease. You will have to take the pin out of the hinge to use it. You will also have to watch for excess seeping out of the hinge for a couple of days. Other things like three in one oil and machine oil will also work. Caution needs to be exercised when using oils, don't use to much.