Electrospinning is a common approach for the fabrication of composite carbon nanofibers (CNFs) used as cathodes in lithium-oxygen batteries (LOBs). However, the addition of a salt precursor in the synthetic procedure makes a strong impact on the final morphology and structure of composites, directly affecting the battery performance. Herein, 3D hierarchical porous CNFs with different loading amounts of metallic Co are prepared in situ by the electrospinning method combined with a thermal annealing process. Notably, we find that with the overloading of metallic Co, the resultant hybrid CNFs become rather fragile, resulting in a discontinuous nanorod structure. In contrast, an optimal addition of the Co precursor is found to create a continuous and integrated porous structure within the CNFs, leading to the highest surface area. The free-standing Co/CNFs films can not only supply a high number of active sites and facilitate reactant diffusion but also provide abundant Li2O2 storage that can avoid binder-induced side reactions. Benefiting from the structural advantages and superior catalytic performance of Co, the resultant battery achieves a large capacity, outstanding rate capability and a good cycling stability and exhibits great potential for application in LOBs.