I have a private repo on Github, Repo A. The structure of the project in Repo A is like:
dist/
src/
project-file.js
project-file2.js
I want to make available the src/
directory in a (new) public repo on Github.
Ideally, I would like this to be as automatic as possible. So in the event that I update source files in Repo A, I would like the public repo to be easily updated, too.
I've found a couple of solutions: the first one involves using Github releases and submodules. This one seems to keep the two repos connected but I'm unsure how to push the src/
directory into(?) the submodule and then push that to a fresh, public remote repository.
The other solution I found is using filter-branch
on a cloned repo. The only problem with using the latter that I can foresee is that the two branches then become detached and any changes I make to Repo A will have to be re-cloned again and pushed anew to the public repo.
Basically, I have a private project but I want to make some of the files public for viewing. I believe the first option, using submodules is the better choice, but I'm not sure how to do this in practice. I am not too well-versed with advanced Git techniques so apologies if I'm missing something.
Changing a repository's visibilityOn GitHub.com, navigate to the main page of the repository. Under your repository name, click Settings. Under "Danger Zone", to the right of to "Change repository visibility", click Change visibility. Select a visibility.
No. You can fork it and it still remains private. Private collaborators may fork any private repository you've added them to without their own paid plan. Their forks do not count against your private repository quota.
Private repositories are only accessible to you, people you explicitly share access with, and, for organization repositories, certain organization members.
Submodule remains a simpler option:
That is:
cd /path/to/cloned/original/repo
git rm -r src/
git commit -m "Remove src"
git submodule add https://github.com/you/newSrcRepo src
From there, you can modify files in src and push to that new repo:
cd /path/to/cloned/original/repo
cd src
# work in src
git add .
git commit -m "new src modifications"
git push
And record the new src in your parent repo:
cd ..
git add .
git commit -m "src new state"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With