My application is located on Heroku and I've got a public github repo too.

My application includes a config file that contains my amazon . com S3 qualifications. You need to be sure that the file will get pressed to heroku although not github.

And So I was convinced that I possibly could push my master branch to heroku and make up a seperate github branch and be sure it's .gitignore file references my s3.yml file. I possibly could then simply do "git push origin github:master" to push the github branch to github.com

This works acceptable for the very first commit.

However I change to my master branch, write some awesome code after which push everything to heroku. Then i switch to my github branch and do "git merge master" to ensure that the brand new code will get put into it. But this will cause the s3.yml and gitignore files in the master branch to obtain replicated in to the github branch. Signal mind-to-desk banging session.

Can there be any suggestions about methods to keep branches synched up although making certain that untracked files remain untracked. Can One tell git to not merge within the undesirable S3.yml file and also the different .gitignore file?

Am I flogging a defunct equine here? I can not justify having to pay for any private github account yet however i think of the answer calls for doing exactly that.... or switching to projectlocker

I am wishing this issue is just lower to my garbage git abilities which there's a means.... thanks ahead of time

EDIT::: The recognized answer is a superb solution, but I have just found a replacement which i like a lot more. Find out about it here: http://paperwork.heroku.com/config-vars - individuals clever people at Heroku come with an answer for everything... seriously awesome

But this will cause the s3.yml and gitignore files in the master branch to obtain replicated in to the github branch

You are able to avoid by using a custom merge driver that will make certain towards the .gitignore file from the github branch will invariably retain its content within the one merged from master.

See How do you tell git to continually choose my local version for conflicted merges on the specific file?

in SVN this really is known as 'ignoring files' and so i assume it will likely be such like in GIT - I do not use GIT so don't quote me about this, but I have found this reference around the GITHub website:

http://github.com/guides/ignore-for-git

Hope that can help

You can maybe move the "harmful" files from git entirely - eg ask them to in ~/.yourapp or something like that like this. (that does not really answer the question directly nevertheless its what plenty of software does - .fetchmail, .ssh, ...) and would permit other customers to complete exactly the same.

If you are using a branch named heroku as the "alternative master" branch (with sensitive data) as well as your old master branch with no sensitive data, then you may always do

git merge master

To help you push heroku branch to heroku not the actual branch.