Yes, you can add lemon or ginger to your water while fasting, it will not break your fast as long as you don’t add sugar or cream to it.
The lemon and ginger water contains no calories and is a great option as an occasional replacement for water during fasting.
However, you should be careful not to squeeze or eat the fruit. Because the lemon and ginger themselves contain calories. You’d better add a few slices in water and drink the water without eating the slices.