I have a localhost website and its live version on the internet. what i have is two main
repositories one local and one remote and both are in sync and both track same files. the problem is that there have to be some minor differences between each like local one connect to database with different credentials and different google re-captcha keys and that's all the changes needed (exactly 3 or 4 files each differ by just one line). So is there a way i can keep both in sync, while each repository have its own version of database credentials and re-captcha keys and still make git track these files so in case i changed the keys i can still push them.
CodePudding user response:
You can use a .gitignore file to have git ignore files you don't want to be compared.
I would store keys in an environment variable file full of variables that allows you to configure them as needed in each environment. When you use the variables in the code, it will check the file for the value of those variables and you can have different configuration values in your different environments.