Keeping Parts of Your Codebase Private on GitHub

8 Comments

Comments are ordered by helpfulness, as indicated by you. Help us pick out the gems and discourage asshattery by voting on notable comments.

Got something to add? You can leave a comment below.

  1. Amey

    Wouldn’t it be easier and cleaner to use git submodules, and keep the private parts inside a submodule that lives as a private git repo? That way it’s easier to differentiate what’s public and what isn’t, and it’s also migrateable, so you wouldn’t need to add the private remote manually if you clone the repo on a new machine.

  2. Robert Lee-Cann

    I’d be fearful of using this technique; It would only take an accidental pre-caffeine “git push origin dev”, and the dev branch gets pushed to public!

    I know you can easily “git push origin :dev” to delete the remote branch afterwards, but the damage could already be done.

  3. david

    Thank you,
    I have a quest.
    first I had a master branch, then I made my private branch and I added some files or modified some files that are also in the master branch.
    now I want to revert all the modified files in the private branch to the version of master branch , but keep the added files in this private branch.
    every thing local, but im supposed to just push the private branch.
    would you please help me? thank you.

    Best
    david

  4. David Hund

    First off: thanks Harry: great to learn of these Github workarounds!

    I love Github but I use Bitbucket too. I would use Bitbucket a lot more, however, if it would support Pages like Github does: with a personal domainname.

    At the moment Bitbucket does not support CNAME’s and unfortunately they seem not too keen to support this soon: https://bitbucket.org/site/master/issue/2184/support-cnames-for-repositories-bb-3655

  5. Ruben

    Couple of things.

    First, as someone mentioned BitBucket is, IMO, at par or better than GitHub in terms of features. The fact that you can have unlimited private repos alone is enough a reason to migrate over. I understand that people like GitHub because it’s so popular, but you are missing out by not looking at BitBucket or other competitors.

    Second, the problem is that GitHub is not supposed to be a CMS, even though some people want to use it as such. Use GitHub as a project/source base, have its website completely separate. You have to do so much git judo because you are trying to use it for something it wasn’t meant for.

Impress us

Be friendly / use Textile