2

I've cloned a github project, and have to make some modifications in private (e.g. entering payment information). Github won't allow me to make a forked repo private, saying I should duplicate it instead.

Following their instructions didn't work for me (got some error, working on it with their support). Still, I don't understand the flow - I need to be able to do all of these:

  1. Get updates from the origin repo when I need to.
  2. Keep at least one repository private.
  3. Make some changes and push them back to origin. Perhaps this will require an extra public repository.

I'm not sure what's the best practice on how to sync all this together. Got any advice for me?

ripper234
  • 222,824
  • 274
  • 634
  • 905
  • If you push back to the public repo, all your private modifications will become public, so what's the point? – JB Nizet Dec 26 '12 at 08:57
  • @JBNizet - I have some private modifications I'd like to do, plus some that I want to make public. I guess I need two repositories - public & private. My question is how to neatly, consistently and periodically import changes from my public repo to the private one? – ripper234 Dec 26 '12 at 12:24

2 Answers2

1

If you don’t care about pushing your commits to « save » them on a remote private server, just do a simple clone on the read-only version (local one, actually).

Otherwise, you can use Bitbucket to push your private stuff:

$ git clone … # the original project
$ git remote add ghost git@bitbucket.org/your_own_repo.git
$ git fetch origin # fetch the original
$ git push ghost master # push the head master into your own repo

When you need to update through the original project:

$ git pull origin *the_branch*

And push data to:

$ git push ghost *the_branch*

BUT like JB Nizet said, I don’t see the point here. Why just not contribute a normal way?

phaazon
  • 1,972
  • 15
  • 21
1

If your private modifications are more private configuration values, then:

  • don't version those values at all in a git repo (any git repo): the risk of accidently pushing them where you shouldn't is too high.
  • store them in another referential (any cloud service allowing you to save a file, even possibly encrypted): no need for a "private fork" here.
  • only version a template of that config files, and a file with the public values.
  • use a content filter driver to:
    • check if you check out the Git repo in the right environment (like your computer)
    • if so, access your other referential, get back the values and generate the final configuration file with the right (private) values.

smudge

See this answer for a concrete example.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250