简体   繁体   中英

Pushing to Github Repo from Eclipse, how to hide sensitive data, but make repo public?

I am wondering how I can push to my Github repo (which I need to be public so I can showcase to employers), without showing sensitive info. I am using Eclipse/Java.

I have made a project which runs tests with Selenium webdriver in Chrome, I don't want people to be able to see the login information in my code, for obvious reasons.

The stuff online about Git/Github is a bit of a minefield for a beginner like me and I am finding it hard to understand.

Thanks in advance,

Split all (hardcoded) configuration data into a separate file, for example Config.java or application.xml or some format you like.

Create a .gitignore file in your project directory, listing all the files / folders that should be ignored, for example the configuration file mentioned above, and some other generated file, compile output, jar file, etc.

If you have accidently added some sensitive data that exists in your Git history, use git filter-branch to remove those file from history.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM