I cloned a git repository but accidentally messed up. So I re-cloned and the message showed up:
destination path already exists and is not an empty directory
I've tried deleting folders in my mac with the name of the destination path but it did not work.
I'm very new to coding so all help would be appreciated.
To clone git repository into a specific folder, you can use -C <path> parameter, e.g. Although it'll still create a whatever folder on top of it, so to clone the content of the repository into current directory, use the following syntax: cd /httpdocs git clone [email protected]:whatever .
Thereby generating the error: fatal: destination path '/my/path' already exists and is not an empty directory. Create a job that clones a repository into the /builds directory. Run it twice, and the second time should fail since the cloned repo is still present.
Sorry, something went wrong. fatal: destination path 'flutter' already exists and is not an empty directory. Sorry, something went wrong. Error: The Flutter directory is not a clone of the GitHub project.
The message destination path'XXX' already exists and is not empty directory is displayed during code clone from a cloud repository. The repository directory already exists and is not empty. Delete the local repository directory and clone the cloud repository again. Run git pull to merge the cloud and local repositories.
1 Fatal: destination path 'opencv_contrib' already exists and is not an empty directory 1 Heroku: How do I deploy to an existing app Related
Explanation
This is pretty vague but I'll do what I can to help.
First, while it may seem daunting at first, I suggest you learn how to do things from the command line (called terminal on OSX). This is a great way to make sure you're putting things where you really want to.
You should definitely google 'unix commands' to learn more, but here are a few important commands to help in this situation:
ls
- list all files and directories (folders) in current directory
cd <input directory here without these brackets>
- change directory, or change the folder you're looking in
mkdir <input directory name without brackets>
- Makes a new directory (be careful, you will have to cd into the directory after you make it)
rm -r <input directory name without brackets>
- Removes a directory and everything inside it
git clone <link to repo without brackets>
- Clones the repository into the directory you are currently browsing.
Answer
So, on my computer, I would run the following commands to create a directory (folder) called projects within my documents folder and clone a repo there.
cd documents
(Not case sensitive on mac)mkdir projects
cd projects
git clone https://github.com/seanbecker15/wherecanifindit.git
cd wherecanifindit
(if I want to go into the directory)p.s. wherecanifindit is just the name of my git repository, not a command!
This error comes up when you try to clone a repository in a folder which still contains .git
folder (Hidden folder).
If the earlier answers doesn't work then you can proceed with my answer. Hope it will solve your issue.
Open terminal & change the directory to the destination folder (where you want to clone).
Now type: ls -a
You may see a folder named .git
.
You have to remove that folder by the following command: rm -rf .git
Now you are ready to clone your project.
For those comming here wishing to clone a repo in an existing folder that already contains files/folders, try this:
cd /
git init
git remote add origin <your-repo>
git pull
git checkout master -f
This example is for the root folder. Change "/" to point to your specific folder
Steps to get this error ;
Solution : rm -rf "name of repo folder which in out case is xyz" . So
rm -rf xyz
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