The Giants officially signed free agent Alex Cobb to a two-year, $20 million contract Tuesday night.