The problem in detail
I am making a game, and intend to open source the code but keep the assets private. My goal is to track the assets and game together in a private repository so that I can take advantage of version control with them, but only track the source code of the game in a public repo without committing the assets to that public repo. However, I cannot find a way to do this properly.
Attempted solutions
I have two remote repositories on GitHub, one is public and the other is private. I have set up a master branch, which I intend to commit to the private repository, and a branch called master-public, which will commit to the public repository. In order to prevent accidentally committing assets to the public repository, I successfully implemented this solution, and have my assets folder ignored on the branch master-public but not on the branch master. My intent was to make feature branches from master-public, merge feature branches with master-public, and then rebase master-public onto master. However, I cannot find a way to commit the assets to the private repo without either accidentally putting them into the public branches, or making them unavailable to all other branches. If I commit the assets folder to the master branch, they disappear from the directory when using checkout to switch to another branch. I have tried to mitigate this by adding it to a regular .gitignore, creating a branch out of the original master, then force adding the ignored asset and committing it; The file remains unavailable in other branches no matter how I attempt to make this work, despite trying the advice here as well.