ProjectStack
git

fatal: destination path already exists and is not an empty directory

Git can't clone into a directory that already exists and contains files. Git requires the target directory to be empty or non-existent.

Common causes

  • You already cloned the repo and are trying to clone it again
  • A directory with the same name as the repo exists in the current folder
  • A previous interrupted clone left a partial directory behind
  • You're running the clone command from inside the project directory

How to fix it

  1. cd into the existing directory instead of cloning again: cd <repo-name>
  2. Delete the existing directory if it's safe to do so: rm -rf <repo-name>, then clone
  3. Clone into a different directory name: git clone <url> <new-name>
  4. If it was a partial clone, remove it and retry: rm -rf <repo-name> && git clone <url>

Example

fatal: destination path 'my-project' already exists and is not an empty directory.

Running git clone when you've already cloned the repository into the same directory

Have a different error?

Paste any error message into the Error Translator to get an instant explanation.