owzim
owzim

Reputation: 925

Preventing certain files from being pulled in git

I have some files that I want to be ignored via git pull on a remote machine. I still want it to be a working copy, for updating only the changes. On my local machine I don't want those files to be ignored.

I tried adding the files in .gitignore on the remote machine, but I guess it's only for commits.

How to accomplish this?

Upvotes: 6

Views: 2437

Answers (1)

Adrian Cornish
Adrian Cornish

Reputation: 23858

You cannot - the point of git is you get a full copy of the repository - you are implementing the "I have a hammer so everything is a nail principle" and trying to make it do something is was never designed to do - I suggest you switch tools if the is a break all requirement.

If you do not want the file in the repo - do not add it.

If you want to control access to certain files - move them to a separate repo and restrict access.

Upvotes: 6

Related Questions