Question: `git mv` renames a file or directory in a repository. How do I rename the Git repository itself?

Answer: 
With Github As Your Remote
==========================

### Renaming the Remote Repo on Github

Regarding the remote repository, if you are using Github or Github Enterprise as the server location for saving/distributing your repository remotely, you can simply rename the repository directly in the repo settings.

From the main repo page, the settings tab is on the right, and the repo name is the first item on the page:

[![enter image description here](https://i.stack.imgur.com/zbZ4z.png)](https://i.stack.imgur.com/zbZ4z.png)

### Github will redirect requests to the new URL

One very nice feature in Github when you rename a repo, is that **Github will save the old repo name and all the related URLs and redirect traffic to the new URLs**. Since your username/org and repo name are a part of the URL, a rename will change the URL.

Since Github saves the old repo name and redirects requests to the new URLs, if anyone uses links based on the old repo name when trying to access issues, wiki, stars, or followers they will still arrive at the new location on the Github website. Github also redirects lower level Git commands like `git clone`, `git fetch`, etc.

More information is in the [Github Help for Renaming a Repo](https://help.github.com/en/github/administering-a-repository/renaming-a-repository)

Renaming the Local Repo Name
============================

As others have mentioned, the local "name" of your repo is typically considered to be the root folder/directory name, and you can change that, move, or copy the folder to any location and it will not affect the repo at all.

Git is designed to only worry about files inside the root folder.
Have you try changing your project name in `package.json` and execute command `git init` to reinitialize the existing Git, instead?

Your existing Git history will still exist.