Randy TravisLocals RUSHED to Jail to Give Him $$$, Clothes

8/9/2012 7:05 AM PDT BY TMZ STAFF

Randy Travis was NOT wearing a Texas Longhorns hat at the time of his naked arrest ... it was a gift from a local attorney who rushed to the jail the second he heard the country star was in trouble.

TMZ has learned ... moments after word got out about Travis' arrest, several locals raced over to the jail to help out -- one man posted Randy's cash bond and another man offered legal services right away.

The lawyer was Gary Corley ... who tells TMZ the area around Sherman, TX is a close-knit community where the people take care of each other ... and he wanted to "do the humanitarian thing" and help Travis.

When Corley arrived to the jail, he briefly met with Randy, offered his services, and told him about the legion of photographers waiting outside the jail to shoot the singer.

Corley tells us he was wearing his Texas hat at the time, but decided Randy probably needed it more ... and literally gave him the cap right off of his head so the singer could shield his face from shutterbugs on his way out.

We're told Corley had a car waiting for Travis in case he wanted a ride ... but the man who posted Randy's cash bond had already arranged for transportation ... so Randy went with his money man.

So far, we're told Randy has not officially hired an attorney ... but Corley says he'll be there if he needs him.