Hitchiking north to France
There is a Area de Servei El Girones petrol station on AP 7 near Girona Costa Brava airport which is easily reachable by a small road that goes from the airport. It starts at the roundabout next to the airport. Walk about 1 km north along the highway, then turn right to the smaller road that will pass under the highway and lead you to the petrol station (check the map). It's enough traffic in it, some places to put your tent and a cafeteria (with NO wifi).
Hitchiking south to Barcelona
Walk south on Carrer de Barcelona (which is a major road running north-south through the city) until you see a Repsol petrol station (http://goo.gl/maps/hZOj) on the right-hand side, just before a round-a-bout and very close to a Decathlon sports shop. There's space for cars to stop if you hold a sign along the road here, as well as the option to ask drivers at the petrol station.
Thumbing a ride directly at the roundabout leaving the airport also works well.
If you're going to Barcelona and can only find a car going part of the way, I recommend trying to stay on the A7/AP-7 motorway (peage/toll road) instead of the coastal road (A2), because most cars driving longer distances take the toll road, and there are big motorway petrol stations along the way. You can find a free city map in the tourist office in Girona.
For high speed trains they check tickets before entering the platform so if you want to go for free you need to take slower trains.