git - destination path already exists and is not an empty directory

git – destination path already exists and is not an empty directory

git – destination path already exists and is not an empty directory

Explanation

n

This is pretty vague but Ill do what I can to help.

n

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 youre putting things where you really want to.

n

You should definitely google unix commands to learn more, but here are a few important commands to help in this situation:

n

ls – list all files and directories (folders) in current directory

n

cd <input directory here without these brackets> – change directory, or change the folder youre looking in

n

mkdir <input directory name without brackets> – Makes a new directory (be careful, you will have to cd into the directory after you make it)

n

rm -r <input directory name without brackets> – Removes a directory and everything inside it

n

git clone <link to repo without brackets> – Clones the repository into the directory you are currently browsing.

n

Answer

n

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.

n

    1. n

    2. Open terminal

n

    1. cd documents (Not case sensitive on mac)

n

    1. mkdir projects

n

    1. cd projects

n

    1. git clone https://github.com/seanbecker15/wherecanifindit.git

n

    1. cd wherecanifindit (if I want to go into the directory)

n

n

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).

n

If the earlier answers doesnt work then you can proceed with my answer. Hope it will solve your issue.

n

Open terminal & change the directory to the destination folder (where you want to clone).

n

Now type: ls -a

n

You may see a folder named .git.

n

You have to remove that folder by the following command: rm -rf .git

n

Now you are ready to clone your project.

git – destination path already exists and is not an empty directory

Steps to get this error ;

n

    1. n

    2. Clone a repo (for eg take name as xyz)in a folder

n

    1. Not try to clone again in the same folder . Even after deleting the folder manually this error will come since deleting folder doesnt delete git info .

n

n

Solution :nrm -rf name of repo folder which in out case is xyz . So

n

rm -rf xyzn

Related posts on git :

Leave a Reply

Your email address will not be published.