Texas joined the Confederacy on March 2, 1861 (secession convention) and was admitted May 1861. It remained a member state until June 19, 1865 (Juneteenth), when Union General Granger enforced emancipation in Galveston.
The phrasing "ruled by the Confederate government" is inaccurate: Texas had its own governor (Francis Lubbock, then Pendleton Murrah), legislature, and militia. The CSA exerted authority over defense, foreign policy, and currency, but day-to-day governance remained state-level. No separate Confederate administration "ruled" Texas distinct from other member states.