How to rename the wp-config.php file once under version control?

Do not rename or modify the sample files unless such modifications are intended for contribution – they are there for reference. The files wp-config.php and wp-tests-config.php are explicitly ignored by .gitignore. Simply create them as new files yourself (or, if you’d like to use the sample files verbatim create symlinks to the sample files) to avoid unnecessary disparity with upstream.