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
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.
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.
If it's just one file, you can just use the raw link. Go to that file on GitHub and click "raw"
Just use the link in the adress bar and it should work...
Using the raw link provides a URL with a "token=", which seems to expire after a certain number of days.
来源:https://stackoverflow.com/questions/46875559/share-publically-a-part-of-a-private-repo-on-github