The 24-year-old, whose move is subject to FA and EFL approval, will formally join League One Rovers on July 1 after his current deal expires.
Hare reached the National League play-off semi-finals with Eastleigh last season following a summer switch from Maidstone.
Manager Graham Coughlan told Rovers’ official website: “Josh has made real progress over the last three years in his development and climbing up the football pyramid.
“He had a great season with Eastleigh, reaching the play-off semi-finals and being named in the National League Team of the Year.
“We are confident he is ready to take the step into the Football League and we are sure he will add healthy competition to the squad.”