A Harvard man has been sentenced to eight years in prison in a plea deal after he fired a gun near Woodstock Square in 2023.