git mv
renames a file or directory in a repository. How do I rename the Git repository itself?
There are various possible interpretations of what is meant by renaming a Git repository: the displayed name, the repository directory, or the remote repository name. Each requires different steps to rename.
Rename the displayed name (for example, shown by gitweb
):
.git/description
to contain the repository's name.Git does not reference the name of the directory containing the repository, as used by git clone master child
, so we can simply rename it:
mv
from the command line or the F2 hotkey from a GUI).Rename a remote repository as follows:
[email protected]:User/project-new.git
)Set the new URL using Git:
git remote set-url origin [email protected]:User/project-new.git
A Git repository doesn't have a name. You can just rename the directory containing your worktree if you want.
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