Hello,
Stress or hormonal changes may lead to excess oil produced by the oil glands in your scalp. This causes the harmless bacteria that live in the scalp to proliferate and feed off the oil, which produces the odor. I would suggest you to clean your hair frequently with a mild shampoo (you can use the ones for gentle hair). Also you can shampoo twice during each wash and apply shampoo on the scalp without piling the hair on top.
I hope it helps. It is very difficult to precisely confirm a diagnosis without examination and investigations and the answer is based on the medical information provided. For exact diagnosis, you are requested to consult your doctor. I sincerely hope that helps. Take care and please do keep me posted on how you are doing.
Eccrine bromhidrosis may be related to the ingestion of certain foods such as onion, garlic,asparagus, spices such as fenugreek and curry powder.
Certain bacteria are also involved here.A herbal shampoo with hibiscus may be helpful.Do consult your doc.