Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git: removing a file from being versioned, but not deleting it

I have a file which ended up being versioned in our repository but shouldn't have been. For arguments sake, the file is config.py. We instead version config.py.tpl but never the actual production config for the obvious reasons.

What's the right way to stop versioning this file without deleting it locally from the working directory? Also want to make sure that it doesn't show up next time the repo is archived and untarred in production.

I've already added the file to .gitignore.

like image 237
randombits Avatar asked Dec 02 '09 02:12

randombits


1 Answers

To remove it from the repository use the following command and keep config.py in the gitignore:

git rm --cached config.py
like image 171
seth Avatar answered Oct 13 '22 11:10

seth