Third baseman Casey McGehee and the San Francisco Giants have agreed to a $4.8 million, one-year contract and avoided salary arbitration.