title: Publishing local repository by ignoring certain files
body: <p>I am developing on my Mac system and have created local <code>git</code> repository which I then publish to remote repository. I have <code>.env</code> file for every project which includes some sensitive data also. Ofcourse, I have to save this <code>.env</code> file in my local repository to avoid recreation in case I have to move to another system. But I have read in many online documentation that <code>.env</code> should be added to <code>.gitignore</code> to avoid sharing it publicly. If I add this file in my <code>.gitignore</code> then it will also be removed from my local repository. </p>
  
  <p><strong>What is the best way or possibility to have this <code>.env</code> file to only be ignored while publishing to remote repository?</strong></p>