I am looking to set some files within a private repo to be public readable files. (or read-only for certain users.)
I use a private repo to store my notes. I would like to share some (not the whole repo) of these note files as read-only. Ideally would be able to set some files to public and not require any user logins. But if I must use a user-login, then that is fine. My gitea instance is not accessible via the public internet.
Is this possible? I suspect it may not be as I was unable to find in the settings or the docs.
If you have a clear file structure, it is possible:
To do that, you simply extract the files that should be public into a folder inside your repo, and initialize a new repository there as you would always do using
Then, in the private repo add the file
.gitmodules in the root folder with the content
path = $REPO
url = ../$REPO.git
where you replace
$REPO with your new repo (and folder) name.
If you push both that, and the original repo, you now have two repositories. The original is your private repo, and the other can then be a public repo.
The only downside is: If you update the public repo, you also need to update the private repo to point to the latest commit, as it simply stores a commit at which it points.
You can also easily set read-only permissions then, simply by enabling (and configuring) branch protection on the public repo.
Thank you. That is an Interesting suggestion, this would likely work well for many people. For my needs it adds an un-needed complexity.