Reputation: 75
Is it possible to ignore specific files in git only for certain remotes? e.g., I'm storing AWS S3 credentials (s3.yml
) in a file for an app hosted on Heroku, thus I need to check s3.yml
into my repo for the deploy to work. However, I'd like to publish the source to GitHub as well, so I would be wise to keep s3.yml
out of the repo. I would imagine it working something like
#.gitignore
github:config/s3.yml
but haven't been able to find anything in the git docs. Is this possible? Or do I need to maintain two separate repos?
Thanks!
Upvotes: 7
Views: 550
Reputation: 4580
Heroku has config-vars for this sort of thing. Their opinion seems to be that the s3 information shouldn't be checking into Git. Check out this link for more information about how they're expecting this sort of thing.
Upvotes: 3
Reputation: 405
That file is always going to live in the repo if you publish it as is. Even if you created a branch and git-rm'd the file, people would always be able to check out the version that still had the file. I don't see any way of using a single repository while keeping a single file inaccessible on a remote.
The core problem is that, as a distributed SCM, each repository has a full revision history. Since the changelists are cryptographically signed based on their content, it's not possible to erase a file without changing the hash of each changelist all the way back to when the file was added. This is something git can do, but at that point you have two separate repositories that won't be able to directly/easily push/pull.
Upvotes: 3