When the defendant is arraigned, he must be informed that if the name by which he is prosecuted is not his true name, he must then declare his true name, or be proceeded against by the name in the accusatory pleading. If he gives no other name, the court may proceed accordingly; but if he alleges that another name is his true name, the court must direct an entry thereof in the minutes of the arraignment, and the subsequent proceedings on the accusatory pleading may be had against him by that name, referring also to the name by which he was first charged therein.