Exclude local git folder from repository?

My project contains a git folder that appears to have been created a year ago. The git folder is 2.3GB and is in my repository.

Is this something I can safely exclude from the repository?

I don’t even know how or why it was created, but my guess would be that Visual Studio created in while I was switching back and forth between git and Team Foundation Server.

Any insight?

I have experienced this in VS Code myself. This sometimes happens when git is globally set on your directory.

You can try the following:

Add the folder path to your repo’s root .gitignore file.

path_to_your_folder/

Remove the folder from your local git tracking, but keep it on your disk.

git rm -r --cached path_to_your_folder/

Push your changes to your git repo.