1

The previous question Hidden markdown text on GitHub covers how to hide text using comments for the purposes of notes to self.

I have done this, but people can still click through to the code of README.md and see the hidden comments. Is there a way of keeping the source code of README.md private?

A search for any way to do this returns information about hiding things using comments. I'm fine with that, but I would like a way to keep the code itself private.

E. Rei
  • 125
  • 4
  • 1
    _"Is there a way of keeping the source code of README.md private"_ Don't commit it/push it to GitHub = secret. Or use a private repo! You should consider anything pushed to a public repository as public. There's no way to keep portions of a file hidden like this. Even if you could do it in GitHub, I could clone the repo and open the README.md in any text editor. – phuzi Aug 03 '23 at 14:56
  • I'd like people to be able to read the document. But not go through to the source code and see my notes to self. – E. Rei Aug 03 '23 at 14:59
  • The purpose of public repositories on GitHub is to share source code publicly. If you do not want code to be made public, do not commit/push the code to a public repo. – Waylan Aug 03 '23 at 15:02
  • @E.Rei why not write a quick script to strip out your notes? you'd work on a file that wasn't added to the repo (i.e. likely in `.gitignore`), then run this script to convert it to the public version. you could automate this with a git filter if you want to get fancy – Sam Mason Aug 03 '23 at 15:04
  • @SamMason's suggestion could work, but remember your private file would only be on your local system. You will need to back it up/sync it with multiple machines another way. – Waylan Aug 03 '23 at 15:06
  • 2
    note that anything pushed to a public repo is public, anybody can clone it to see "the code" (i.e. the actual file), whether the default Web interface makes that easy or not – Sam Mason Aug 03 '23 at 15:06

0 Answers0