He was born in Charleston, South Carolina to Emma Louisa Lanneau (daughter of Bazille Lanneau and Hannah Vinyard) and Benjamin Gildersleeve (1791–1875). His father was a Presbyterian evangelist, and editor of the Charleston "Christian Observer" from 1826 to 1845, of the Richmond, Virginia "Watchman and Observer" from 1845 to 1856, and of "The Central Presbyterian" from 1856 to 1860. His maternal grandfather was Bazile Lanneau (born Basile Lanoue), one of the many French Acadians who were forcibly expelled by the British from present day Nova Scotia during the French and Indian War. His maternal grandmother was Hannah Vinyard. He graduated from Princeton in 1849 at the age of eighteen, and went on to study under Johannes Franz in Berlin, under Friedrich Ritschl at Bonn and under Friedrich Wilhelm Schneidewin at Göttingen, where he received his Ph.D. in 1853. Upon returning to the United States, he was offered a position as a Classics professor at Princeton, but he turned it down. From 1856 to 1876 he was professor of Greek at the University of Virginia, holding the chair of Latin also from 1861 to 1866. He married September 18, 1866 in Middlebury, Virginia to Eliza Fisher Colston.