South Sudan's government and rebels on Thursday signed a ceasefire agreement, pledging to halt fighting within 24 hours and end more than a month of intense fighting, an AFP correspondent witnessed.