IMTheNachoMan
IMTheNachoMan

Reputation: 5811

How to prevent non contributors from seeing specific files in a public GitHub repo?

I have a public GitHub repo with a bunch of files. For certain files, I want them to be in GitHub so I, and other contributors can use them, but I don't want everyone (the public) to be able to see them.

Is this possible?

Upvotes: 2

Views: 630

Answers (1)

VonC
VonC

Reputation: 1323135

Git or GitHub cannot protect part of a public repository: if you can access said repository, you would clone everything.

That being said, you could add a content filter driver which would automatically on checkout:

  • fetch those files from another source (separate private repository, as commented)
  • create them in your local working tree (if your local public repository clone)
  • make sure they are ignored locally.

However, any evolution of those files should be synchronized in a local clone of your separate private repository, and pushed from said local private clone.

Upvotes: 2

Related Questions