The Gettysburg Railroad was a railway line in Pennsylvania that operated from 1858 to 1870 over the 17-mile (27 km) main line from the terminus in Gettysburg to the 1849 Hanover Junction. After becoming the Susquehanna, Gettysburg & Potomac Railway line in 1870, the tracks between Gettysburg and Hanover Junction became part of the Hanover Junction, Hanover and Gettysburg Railroad in 1874, the Baltimore and Harrisburg Railway in 1886, and the Western Maryland Railway in 1917.