Vishnudharmottara Purana (Jyotisha Selections) · by Vyasa
Chapter 4 · Ayana, Months, Tithis, Karanas, Muhurtas and the Lagna Vargas
अयनमासतिथिकरणमुहूर्ताः लग्नवर्गाश्च
मार्गशीर्षस्तथा सौम्यः पौषस्याज्जीवदैवतः ।पैत्र्यो मासस्स्मृतो माघः फाल्गुनो भगदैवतः ॥ ५ ॥
In the full Vishnudharmottara Purana this is Khanda 1, chapter 83, verse 5.
Margashirsha is Soma's. Pausha has Jupiter as its god. Magha is remembered as the ancestors'. Phalguna has Bhaga as its god.
Simple meaning: Margashirsha belongs to Soma, Pausha to Jupiter, Magha to the ancestors and Phalguna to Bhaga.
मासेषु मासदैवत्या शुक्लपक्षाः प्रकीर्तिताः ।
The bright halves belong to the month's own god. Next, the gods of the dark halves are given.
चैत्रो याम्यस्स्मृतो राजन्नाग्नेयश्चाप्यनन्तरः ।
The dark half of Chaitra is Yama's, the next is Agni's, Jyeshtha's is Rudra's and Ashadha's belongs to the snakes.
पैत्रश्च श्रावणो मासः सावित्रश्चाप्यनन्तरः ।
The dark halves of Shravana, Bhadrapada, Ashvayuj and Kartika belong to the ancestors, Savitri, Mitra and Indra.