I want to rename a directory versioned by Git on a Windows system (change the case of the directory name):
$ git mv docs DOCS Rename from 'docs' to 'DOCS/docs' failed. Should I try again? (y/n) n fatal: renaming 'docs' failed: Permission denied
I've also tried with the force-option - but with the same result:
$ git mv --force docs DOCS Rename from 'docs' to 'DOCS/docs' failed. Should I try again? (y/n) n fatal: renaming 'docs' failed: Permission denied
For some reason Git fails because it thinks DOCS already is an existing directory and the directory should be moved inside it. I know that I can rename & commit using a temporary directory name and then rename & amend-commit to the final name, but isn't there a way to tell Git that I don't want to move inside any other directory?
To rename any file or folder, use git mv command which takes two arguments. The first argument is the source and the second is the destination. We can easily rename any file using the git command and the new name will be assigned to that file. We can rename the file using GitHub or the command line.
On GitHub.com, navigate to the main page of the repository. Under your repository name, click Settings. Under the Repository Name heading, type the new name of your repository. Click Rename.
You can try to do it in 2 step.
$ git mv docs DOCS2 $ git mv DOCS2 DOCS
it will work
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With