My project is currently hosted in a private repository. I'm looking to introduce a dependency to a third party library hosted in a public repository on GitHub. How can I fork the library so that it becomes a subdirectory in my project, but I can still sync from the trunk branch of that library?
Github does not allow a forked repository to be private. This article describes a way to make a private repo that can pull new features of a public repo. The private repo will behave just as a forked repo of the public repo.
You can fork any repo by clicking the fork button in the upper right hand corner of a repo page. Click on the Fork button to fork any repo on github.com. Source: GitHub Guides.
This is called submodule and is described in details at http://git-scm.com/book/en/Git-Tools-Submodules
This sequence would get you set up:
cd <my-project-dir>
git submodule add <github repository> <my-third-party-dir> # -b <branch> optionally
git submodule init
git submodule update
At this point you've got my-third-party-dir populated with a particular commit (a detached head). Your project will have two changes.
git add .gitmodules <my-third-party-dir>
git commit -m 'Added <repository> as a submodule'
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