Three train cars derailed just after midnight Tuesday in the CN rail yard in Aldershot, officials say.

The cars all derailed upright and weren't carrying any dangerous goods, communications officer Lindsay Fedchyshyn told CBC Hamilton. The trains were carrying a type of rock called callast.

"It didn't affect any main lines or commuter traffic," Fedchyshyn said. GO Train service was not affected.

Crews should be finished cleaning up in the rail yard by the afternoon.