How to rename git root folder?
Yes, it is safe to rename the folder containing a Git repository. All paths inside the Git repository are relative.
To amend slightly Greg's answer, yes, everything with a git repo is relative to the .git
parent directory, but:
(and this won't probably affect you directly, I only mention those reasons here for completeness' sake.):
- the path of the repo itself could be referenced by other services running on your computer (Apache, ssh, another repo declaring your repo as a remote, using the full file path, a gitolite layer declaring your repos in a certain path, ...)
- some operations use the full path of the repo (like the
GIT_INDEX_FILE
using within afilter-branch
command for instance, see this thread), so, obviously, don't rename the root directory while performing a complex operation on your repo.
Plus, a "windows copy" (instead of a git clone
), will copy everything including hooks, which may include absolute path in their script if you have edited them and made those kind of modification.