It's possible to have different exclude information on both servers [1]. However with that said, this won't stop a pushed file from being downloaded on the server that has that file excluded. There is no way to stop git from pulling all files when you pull.
You would need to have two repositories if you have different files, or use some sort of submodule approach for shared files (repoA
and repoB
go to serverA
and serverB
, and both include a shared submodule repoShared
) - but this is now really pushing what is already a non-ideal use case for git.
[1]:
Git stores exclude information in $GIT_DIR/info/exclude
(where $GIT_DIR
is your .git
folder within you repository), so you could hardcode relevant files in there.
Note, if you already have unstaged changes you must run the following after editing your ignore-patterns:
git update-index --assume-unchanged [<file>...]
See the relevant documentation, or previous posts on similar matter.