The resignation of Rahmatullah Nabil on Thursday highlights the domestic backlash Ghani faces over his attempts to repair strained relations with Pakistan, long blamed for nurturing the Taliban.
But Ghani has staked considerable political capital in advocating bonhomie with the neighbour, saying it was a necessary partner in restarting peace talks aimed at ending Afghanistan's long war.
"Without positive support from Pakistan, won't the war in Afghanistan keep dragging on? You answer me," Ghani told a press conference on Friday.
Nabil resigned a day after he posted a scathing Facebook post criticising Ghani's recent high-profile visit to Pakistan for a conference that shored up international support for Taliban talks.
Also Read
"Our innocent countrymen were being martyred and beheaded in Kandahar airfield... At the moment when (Pakistan) Prime Minister Nawaz Sharif once again said Afghanistan's enemy is Pakistan's enemy," he wrote.
He was referring to a 27-hour Taliban siege this week of Kandahar airport, the largest military installation in southern Afghanistan, which killed at least 50 people.
At the Islamabad conference, Ghani and Pakistani Prime Minister Nawaz Sharif vowed commitment to the peace process, with the United States and China also offering support.
Pakistan, which wields considerable influence over the Taliban, hosted a milestone first round of peace negotiations in July.
But the talks stalled when the Taliban belatedly confirmed the death of longtime leader Mullah Omar, sparking a power struggle within the movement.
The Pakistan foreign ministry issued a statement Friday saying it hoped consultation on the talks would begin "soon".
"The time has come for different Taliban factions to choose peace... The talks will start soon and we will reach an outcome," he said.