How to make public only one file of a private git repository?
Asked Answered
M

2

10

From my private git repository, I would like to make a single file publicly available. Is there a way to achieve this in say GitHub, BitBucket or elsewhere?

Let me be more precise. I have a Latex project containing, say:

main.tex
chapters/chapter1.tex
...
chapters/chapterN.tex 
main.pdf

I would like to make main.pdf publicly available and distribute a link pointing to it, while keeping the remaining files private. Is there a way to achieve this?

Macrospore answered 3/5, 2018 at 7:39 Comment(0)
A
7

It is not possible to do it with GIT.

Avulsion answered 3/5, 2018 at 7:43 Comment(0)
C
2

In your case, it's better to use some tools which can automatically export your file to another public git repo.

You can use git export tool for that.

You need to create gitexporter.config.json like so:

{
    "forceReCreateRepo": true,
    "targetRepoPath": "my-open-source-repo",
    "sourceRepoPath": ".",
    "allowedPaths": ["main.pdf"]
}

and then run npx giteporter gitexporter.config.json.

These tools create a new repo my-open-source-repo with the same commit history as your current . repo. The my-open-source-repo repo will contain only your main.pdf file and its history.

Cribbage answered 8/1, 2022 at 19:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.