How to make some files on public github repo private?

I have a file that contains passwords for a website I’m currently making and I want to hide it so nobody without access has access to the website because the password is in the file.

Someone help me, please.

You can’t do that, if someone has access to a git repository they have access to all of it.

If you need the passwords to deploy the website via Actions, you can use Secrets to store them and make them available in the workflow.

If those passwords are for your users to log in on the web site, please consider:

  • Do not store passwords in plain text, only hashed with a salt. Doing this correctly is difficult, usually you should rely on functions provided by the programming language or framework you’re using.
  • User account configurations are configuration data, not part of the source of a program. So usually they don’t belong with the sources. Some people keep configuration data for a specific site in a separate repository to keep track of its changes.