Some methods have been presented to avoid collisions among satellites for satellite formation flying mission. The potential function method based on Lyapunov's theory is known as a powerful tool for collision avoidance in the robotic system because of its robustness and flexibility. During the last decade, a potential function has also been applied to UAV's and spacecraft operations, which consists of repulsive and attractive potential. In this study, the controller is designed using a potential function via sliding mode technique for the configuration of satellite formation flying. The strategy is based on enforcing the satellite to move along the gradient of a given potential function. The new scalar velocity function is introduced such that all satellites reach the goal points simultaneously. Simulation results show that the controller drives the satellite toward the desired point along the gradient of the potential function and is robust against external disturbances.