Home > Net >  Can I delete the .git folder from my hosts file manager?
Can I delete the .git folder from my hosts file manager?

Time:06-02

I recently accidentally committed and pushed multiple large files to my git repository. After removing them, the .git folder on my server is sitting at about 32gb, and effecting my website performance. I have no unpushed changes to the live site. Am I able to simply delete this folder to free up that space again, and will git automatically recreate a new one without the references to those large files? I don't need any history or logs of past changes up to this point so I'm ok losing that information.

CodePudding user response:

Since you already pushed the files onto the repo, they will still be there if you try deleting them and cloning it again. But you can revert your previously pushed commit to accomplish what you're asking.

CodePudding user response:

No, if your delete the .git folder you gonna break everything...

You must remove the file from your git history. There are a lot of tutorials to remove a file or sensitive data... Personally, I suggest :
https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/removing-sensitive-data-from-a-repository

  •  Tags:  
  • git
  • Related