How to ignore file from local directory

Hi, I’m looking for a solution to ignore a file from the local repo but need to have that file in the remote. Have a project where a certain file just gets changed by a secure connection number so we don’t need to track it but we do need to have it on remote and local. All the solutions I have tried with .gitignore would either still continue to track the file because it was already committed or it would completely delete the file from the remote.

I’m hoping that there is a simple and easy solution. Thank you in advance.

Goran