The odor was reported at about 8:20 a.m. at the courthouse at 640 Ygnacio Valley Road and officials evacuated the building, Contra Costa County sheriff's spokesman Jimmy Lee said.
Molica said PG&E was notified shortly before 9 a.m. and crews were at the courthouse by about 9:30.
They conducted a thorough search of the building, but didn't pick up any readings indicating that there was natural gas leaking anywhere inside, Molica said.
He said employees said they had smelled the odor on and off in a hallway in the courthouse for the past 18 months, but reported it today because it seemed stronger than usual, Molica said.
"They did the right thing to report it," Molica said.
During their initial investigation, PG&E crews checked all the appliances in the building and checked the roof for possible leaks, but didn't find anything amiss.
The sheriff's office lifted the evacuation order at about 10:35 a.m. after the building was found to be safe, Lee said.
PG&E crews continued to search the area around the courthouse this afternoon and tested the line that supplies gas to the building, but didn't find any problems, Molica said.
He said that occasionally, other types of odors are mistaken for natural gas, but PG&E encourages people to still report possible gas leaks because the company has highly sensitive equipment that can confirm whether gas is present.