Steve Cotterill has been appointed manager of Bristol City on a three-year contract following the departure of Sean O'Driscoll.