By not having things in the house. I do buy biscuits for teas I do for a voluntary organisation I belong to, but these are kept in the garage, which is too much trouble to get to in the evening. If I buy chocolate, which I do rarely, it is also kept in the garage.
I would have loved some chocolate last night. But not so much that I was prepared to put on shoes, go down two flights of stairs, across the car park (which was icy), unlock the garage, find the half bar of Lindt chocolate which is in my car, come back across the icy car park, and up two flights of stairs again. If it had been in the cupboard I would have eaten it!
The other thing is that I don't use the word "craving". To me (and I stress that this is a personal view) the word indicates something one can't control.