I have configured the gamepad using these lines:

cd /opt/retropie/emulators/RetroArch/installdir/bin
Then I used the ./retroarch-joyconfig and mapped the controller.

After that I am stuck, I can find the .cfg but I do not know what to do.

I tried skipping the step and tried to play a game, but it still does not work – The gamepad works fine in EmulationStation btw.