Introduction Coronavirus disease 2019 (COVID-19) has triggered a worldwide outbreak of pandemic, and transportation services have played a key role in coronavirus transmission. Although not crowded in a confined space like a bus or a metro car, bike-sharing users are exposed to the bike surface and take the transmission risk. During the COVID-19 pandemic, how to meet user demand and avoid virus spreading has become an important issue for bike-sharing. Methods Based on the trip data of bike-sharing in Nanjing, China, this study analyzes the travel demand and operation management before and after the pandemic outbreak from the perspectives of stations, users, and bikes. Semi-logarithmic difference-in-differences model, visualization methods, and statistic indexes are applied to explore the transportation service and risk prevention of bike-sharing during the pandemic. Results Pandemic control strategies sharply reduced user demand, and commuting trips decreased more significantly. Some stations around health and religious places become more important. Men and older adults may be more dependent on bike-sharing systems. The declined trips reduce user contacts and transmission risk. Central urban areas have more user close contacts and higher transmission risk than suburban areas. Besides, a new concept of user distancing is proposed to decrease transmission risk and the number of idle bikes. Conclusions This paper is the first research focusing on both user demand and transmission risk of bike-sharing during the COVID-19 pandemic. This study evaluates the mobility role of bike-sharing during the COVID-19 pandemic, and also provides insights into curbing the viral transmission within the city.