Share publically a part of a private repo on Github

两盒软妹~` 提交于 2019-12-03 14:34:36

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!