I would like to push my repo to a public host but it contains private keys.
How can I remove these before pushing? Can SourceTree do this automatically? I.e. find and replace text on push?
I don't think Git/Hg or SourceTree provide a way to do this. The entire point of pushing and pulling is to keep repositories synchronized.
At this point, even deleting the private keys from your repo will be insufficient If you're pushing the entire repo, others will be able to look through the repository history to find them.
There is probably a complex Git/Hg command that can iterate through your history and delete all instances of a file, but you'd get more help with that in a larger forum, like StackOverflow or a Git/Hg mailing list.
Supported Platforms macOS Sourcetree has a lot to offer and, like many developer tools, finding and using it all can be a challenge, especially for a new user. Everyone might not love ...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
We're bringing product updates and pro tips on teamwork to ten cities around the world.Save your spot