In comparison to traditional underwater robots, underwater snake-shaped imitation robots capitalize on the advantages afforded by their deformable bodies. By accurately adapting the hull morphology to the designated operational trajectories, these robots are better equipped for tasks in confined underwater environments. This paper explores the methodologies for shape body and path fitting planning for underwater snake-shaped imitation robots through the lens of spatial geometric analysis. By conducting a geometric analysis of the center of mass and joint positions of each segment, the hull configuration is aligned with the preset path. The inverse solution of Rodrigues' formula is employed to compute the real-time joint angles. Furthermore, a relationship between the eight thrusters and the robot's six-dimensional force wrench is established utilizing the adjoint transformation based on homogeneous transformations. An optimization algorithm is investigated to facilitate real-time thrust distribution. Ultimately, simulation tests validate the efficacy of the proposed methodology.