0

in my local I pushed a version to my server, says abc.env. Then I fix it in my local by adding abc.env to .gitignore, did git commit and push. Then I ssh into my server, do git pull, found that abc.env is still there? How do I fix it?

Alisa T Morgan
  • 667
  • 1
  • 7
  • 12
  • adding to .gitignore does nothing if the file is already tracked by git (it's part of the project history, say). You could then do `git rm --cached thefile` and commit so that then it's gone from branch history moving forward..... but you might also consider removing it from the history altogether so that it's gone from branch history as well. – eftshift0 Sep 29 '18 at 18:49

1 Answers1

0

You need to delete abc.env from the github repo. Please use the following steps 1. remove abc.env from .gitignore file 2. delete abc.env and push the changes 3. add abc.env back to .gitignore file.

if you are using any git clients like gitDesktop or Source tree, it will be easy to follow these steps

Shiju
  • 438
  • 2
  • 7
  • I need the .env in my development, why delete it in local? – Alisa T Morgan Sep 29 '18 at 14:39
  • I suggest you take a backup of abc.env from a local folder. Delete and push the changes to git repo. and add it back to gitignore file. Then copy the file from backup folder to your local work space folder – Shiju Sep 29 '18 at 14:45
  • No need to delete the file, do `git rm --cached ` – Philippe Sep 29 '18 at 16:47