Working with two different "remotes" with git

Asked

Viewed 131 times

0

Would you like to know how I delete sensitive data (passwords and so on) from a remote repository commit, but keep it in another one? I explain:

I have a repository on Github and another on Heroku, my project is pointing to the two repositories. When it comes to going up in Heroku I need to leave sensitive data such as database password, AWS, etc. On Github this information should not go up, but when I give a "git add." and then a "git commit -m..." that commit is in Stage, I can send it to Heroku only by giving a "git push Heroku", but when I need to change something in the project and send it to the github this time the sensitive information will be visible in this penultimate commit, got confused, but it became clear?

Note: It’s not about not checking the file, but deleting a commit from Stage (which contains the sensitive data), keeping the other changes from the last commit.

1 answer

1


Git and versioning systems in general should not store sensitive data such as passwords and credentials, even in private repositories. This is precisely because once in history this kind of problem becomes common.

The solution that Heroku itself recommends is to store this data in environment variables and in your code you only access the data. So they never stay in the history and you don’t risk sending by accident to a public repository.

Documentation and examples here

Browser other questions tagged

You are not signed in. Login or sign up in order to post.