Maj-Gen Ahmed Mohammed escaped unhurt after soldiers shot at his car at the Maimalari barracks, the sources said.
The soldiers blamed him for the killing of their colleagues in an ambush by suspected Boko Haram militants.
Meanwhile, Nigeria’s president has ruled out freeing Boko Haram prisoners in exchange for the release of more than 200 kidnapped schoolgirls.
A government minister had earlier said authorities were ready to negotiate with Boko Haram, but President Goodluck Jonathan insisted on Wednesday that this was out of the question.
“He made it very clear that there will be no negotiation with Boko Haram that involves a swap of abducted schoolgirls for prisoners,” said British Africa Minister Mark Simmonds after meeting Mr Jonathan in the capital, Abuja, to discuss an international recue mission for the girls.
Their kidnapping in Borno state on 14 April has caused international outrage, and foreign teams of experts are in the country to assist the security forces in tracking them down.
Army spokesman Maj-Gen Chris Olukolade described the incident in Maiduguri, the capital of Borno state, as an internal matter and said there was no need for public concern.
But the shooting shows that morale within the army is low as it battles Boko Haram, says BBC Nigeria analyst Naziru Mikailu.