You know, these .gits don't look fine in a PC when you work.So I have decided to delete it. But I'm afraid if it deletes my files/folders cloned/pulled from github under this repository.
            Asked
            
        
        
            Active
            
        
            Viewed 1.6k times
        
    2 Answers
7
            
            
        Deleting the .git folder does not delete the other files in that folder which is part of the git repository.
However, the folder will no longer be under versioning control.
 
    
    
        Froziph
        
- 463
- 2
- 9
- 
                    1If you delete the `.git` folder, will it allow you to use another repo in that place? – Miles Morales Jan 22 '22 at 16:28
3
            
            
        Since having a .git folder in tour sources is an issue when working on your files, you can clone your GitHub repo while setting the .git folder elsewhere (similar to "Can I store the .git folder outside the files I want tracked?"):
cd C:\path\to\parent\folder
git --git-dir=C:\path\to\myrepo.git --work-tree=myrepo clone https://<myaccount@githuub.com/<myaccount>/myrepo.git 
echo "gitdir: C:/path/to/myrepo.git" > myrepo\.git
cd myrepo
# start adding, committing, pushing
Of course, replace <myaccount> and "myrepo" with your GitHub account and your GitHub repo name.
But the idea is:
- in your cloned repo path C:\path\to\parent\folder\myrepo, there will be a .git file which will include the path of the actual .gitrepo
- the .git repo folder will be located in another path outside of your local cloned repo: C:\path\to\myrepo.git
 
     
    