I would like to clone ('fork') a public git repository (residing, say, on GitHub) to our internal network in such a way that whenever a developer clones that forked repository, they automatically get two remotes in their local repository:
origin (pointing to our internal, forked repository)upstream (pointing to the original, public repository)Say we have a public repository at https://github.com/someone/foo.git
I'd now like to have a clone on our internal network at internal-repos:foo.git.
When the developer clones that repository git clone internal-repos:foo.git, they should have two remotes in their working copy
origin pointing to internal-repos:foo.gitupstream pointing to github.com/someone/foo.gitIs that possible? If so, how can I do that? AFACT git remote only operates on the local configuration.
You could try and add a post-checkout hook which would be triggered on a git clone.
That could be possible through the (shared and accessible by all) template folder, as described in "git-clone and post-checkout hook"
See the Template section of the git init command: a git clone --template=/a/shared/folder could declare such a hook, which would then be in the cloned repo, and could add the missing remote.
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