gitgithubbranchgit-commitgit-push

Publicly share part of a private repo on Github


I'm wondering what's the best way to publicly share a file that's in a private repo on Github.

I would like that every time I make a push to my private repository, the file is automatically updated too.

In particular I have a TeX project. I would like to keep the .tex files secret, but I would like to make the PDF file available to everyone.

Note: I'm aware of the existence of the .gitignore option, but I don't want to use it since I want to keep track of the improvements on the .tex files.


Solution

  • I would like to keep secret the tex files but I would like to make available to everyone the pdf file.

    You can dedicate a public repo (with a simple README in it) in order to upload and associate to said public repo an artifact (your pdf) as a GitHub release.

    Add that public repo as a submodule of your private repo: that will create a subfolder with the README in it, explaining where to find the pdf (in the release section of the public repo)

    You can then, from your own private repo:

    All those steps can be scripted, using the GitHub API: here is an example (focused on the release upload part) in bash shell.