4

A similar question has been answered at Is it possible to fork a public GitHub repo into an enterprise repository?

but I wonder what is the best way to clone from public repo to enterprise in a way that I am able to pull all the changes from public (to keep my copy fresh and receive updates) but push to my changes to enterprise(to keep my work)? Is there a way to achieve this without doing crazy things inside my enterprise .git folder?

PS: Those who are wondering why I am trying to achieve this:

I am using Kubespray (https://github.com/kubernetes-incubator/kubespray), this involves making changes to some config files as per my needs. I want to keep those changes, have people in my team be able to make changes and also receive updates on Kubespray project.

How do I solve the problem of having to deal with 2 github accounts? My problem is top level folder will belong to my enterprise github account and inside that there will be another folder (created by a git pull to public github). So the parent folder points to enterprise repo and child folder points to public repo). Do you consider this normal? I mean things will behave differently , a simple git pull will interact with different repositories based on my pwd. If I am doing it wrong, please suggest a set of commands or sequence of steps

Hugo y
  • 1,421
  • 10
  • 20
kk1957
  • 8,246
  • 10
  • 41
  • 63
  • I don't see how your question is different from the one you linked. I don't have much to add to the answer there, except that you don't really lose the branching relationship to the original repo, as long as you continue to pull updates from there. – Sven Marnach Aug 28 '18 at 16:21
  • Unless you can clarify how this question is different, I will vote to close this as a duplicate. – Sven Marnach Aug 28 '18 at 16:23
  • 2
    Possible duplicate of [Is it possible to fork a public GitHub repo into an enterprise repository?](https://stackoverflow.com/questions/29952033/is-it-possible-to-fork-a-public-github-repo-into-an-enterprise-repository) – Sven Marnach Aug 28 '18 at 16:28
  • How do I solve the problem of having to deal with 2 github accounts? My problem is top level folder will belong to my enterprise github account and inside that there will be another folder (created by a git pull to public github). So the parent folder points to enterprise repo and child folder points to public repo). Do you consider this normal? I mean things will behave differently , a simple git pull will interact with different commands based on my pwd. If I am doing it wrong, please suggest a set of commands or sequence of steps . – kk1957 Aug 28 '18 at 16:46
  • This looks rather different to your original question. You can use git submodules for this, or git subtree depending on the specifics. – Sven Marnach Aug 28 '18 at 17:01
  • In general, it's easy to deal with two different accounts – just add a second remote to your git repo, and specify which remote to push from and pull to with each command. – Sven Marnach Aug 28 '18 at 17:03
  • Thanks Sven, let me look into git submodules and subtree – kk1957 Aug 28 '18 at 17:04

0 Answers0