That was half of it. He wanted to get away from Jefferson Davis, who talked about sending much of Lee's Army west to relieve Vicksburg. But the biggest part was to get out of Virginia and live off of the Union for a while. His Pennsylvania campaign was a huge hunt for supplies. His goal was to gather enough supplies for his army to see him through the winter. His commanders reported to Lee on a regular basis just how much they had accumulated.
Confederate General Henry Heth had sent troops to Gettysburg in search of a warehouse full of shoes, when they stumbled into some Federal cavalry. Napoleon is reputed to have said "a dogfight can start a battle" but in this case it was shoes.