Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Removing Repository In Git Bash Without Deleting The Folder

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.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

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.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading