Change a directory name in a Github repository remotely, directly from local Linux Git

gitgithubmvremoteversion control

This is my Git repository:

https://github.com/benqzq/ulcwe

It has a dir named local and I want to change its name to another name (say, from local to xyz).

Changing it through GitHub GUI manually is a nightmare as I have to change the directory name for each file separately (GitHub has yet to include a "Directory rename" functionality, believe it or not).

After installing Git, I tried this command:

git remote https://github.com/benqzq/ulcwe && git mv local xyz && exit

While I didn't get any prompt for my GitHub password, I did get this error:

fatal: Not a git repository (or any parent up to mount point /mnt/c)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

I know the whole point in Git is to download a project, change, test, and then push to the hosting provider (GitHub in this case), but to just change a directory, I desire a direct operation. Is it even possible with Git?

Should I use another program maybe?

Best Answer

The fatal error message indicates you’re working from somewhere that’s not a clone of your git repository. So let’s start by cloning the git repository first:

git clone https://github.com/benqzq/ulcwe.git

Then enter it:

cd ulcwe

and rename the directory:

git mv local xyz

For the change to be shareable, you need to commit it:

git commit -m "Rename local to xyz"

Now you can push it to your remote git repository:

git push

and you’ll see the change in the GitHub interface.

Related Question