The attacking midfielder becomes the Minstermen’s second signing of the summer following Ollie Banks’ arrival from Chesterfield.
The 29-year-old scored 15 times for the Robins last year, with Adam Hinshelwood hoping for more of the same in 2025/26.
York missed out on promotion to the EFL last season despite finishing second.
The goal is to go one better next time around and Newby, who has also played for Chorley, told the club’s website that he is counting down the days until next season.
He said: “It’s brilliant to be here, it’s a great move for me, it’s something that I was really keen to get done as soon as it was mentioned.
“Obviously, meeting the manager as well, I’m just really excited to get started.”