She said she was taken to a local jail but managed to buy her way out. Others were sent to a detention center in Accra, the capital, but she said she was determined to stay in the country “because I’m a businesswoman.”

The roundups have stoked fear among the Chinese migrants and anger at home, generating more than one million posts about the topic on one popular microblog. Chinese officials said they had dispatched personnel to mine sites to investigate, while the authorities in Guangxi, the Chinese region that many of the miners call home, have urged residents not to go to Ghana. The Chinese Embassy has agreed to pay bail, fines for breaking the immigration law and passage home for scores of the miners.

“We went to hide in cocoa farms for three days,” said Shi Jian, a 34-year-old miner from Guangxi Province in southern China. “There was no food, so we ate yams only.”

“When the military police came, they first took whatever valuables they could take — gold, cash,” Mr. Shi said. “Then they poured out the diesel we keep on the site to power the generators and burned all of our excavators and camps.”

A long furtive walk in the bush preceded a nighttime dash to a Chinese-owned company in Obuasi that sheltered him from the authorities. “We scurried to this company at night like rats crossing streets.”

Others described a huddling together in a large group, hoping to evade detection.

“There is no rest,” the woman who hid on a cocoa farm said late last week. Fearing reprisals, she gave only her last name, Li, and took deep breaths as she described her predicament. “We have to move on to a new spot in the cocoa farm every hour because we don’t want the villagers to see us.”

Now, she says, the group no longer hopes to stay in Ghana, having abandoned the cocoa farm on Friday night to make its way to the capital — and eventually back to China.