Your two copies share one set of code. They differ in three places: the config file, the secrets and the database.
A secret is a password for your app, so it never goes in a file that git saves. A host gives it to your live app as an environment variable: a named value the app gets when it starts.