Home > Blockchain >  Removing Repository In Git Bash Without Deleting The Folder
Removing Repository In Git Bash Without Deleting The Folder

Time:05-31

I'm very new to git and am using git bash for about 3 days now. When following a tutorial I accidently wrote git init in the wrong folder, that of my user in the computer. Sadly this means that I can't just delete the folder as it will cause me problems.

Looking online I found git rm -r --cached FolderName Which didn't work, resulting in: "fatal pathspec 'FolderName' did not match any files"

All in all, I hope to change the repository from this random important folder to a folder much further down the folder path, without deleting the current folder the repository is in currently.

CodePudding user response:

Git stores its repository data in a hidden .git folder. If you therefore delete said directory via a simple rm -rf .git you will remove the repository from your current directory. Alternatively you could move the .git folder with a mv .git <your desired location here>. Both would not harm your existing folder structure.

  • Related