Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Share publically a part of a private repo on Github

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

I would like thet every time a make a push in my private repository automatically the file is updated too.

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

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

like image 743
Erik Pillon Avatar asked Oct 22 '17 15:10

Erik Pillon


2 Answers

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:

  • update the README (just for creating a new commit)
  • tag the README submodule repo (to create a tag that you will associate your release with)
  • upload your pdf to the public repo release, associated to the tag created.

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

like image 125
VonC Avatar answered Nov 15 '22 22:11

VonC


Github does not provide such functionality. Github repositories are either public or private, both not both. However, if the part you want to share is small enough (let' say 4-5 files) you can create a public gist. Unfortunately, there is no way to update the gist automatically.

like image 24
georgegkas Avatar answered Nov 15 '22 21:11

georgegkas