Why am I getting a "destination path '.' already exists" error when trying clone from my webfaction server?

55,768

Solution 1

Simply:

git clone [email protected]:github-username/github-repo.git

That will create a new folder github-repo in ../webapps/nameofwebapp/.

In your case:

cd ../webapps/nameofwebapp/
git clone [email protected]:github-username/github-repo.git -b develop ./

If you already did the clone:

cd github-repo
git checkout -b develop origin/develop

Solution 2

Maybe you have a same name git project directory in current path, git clone command will create a new directory and will crash if there is a same name directory.

Share:
55,768
user2492364
Author by

user2492364

Updated on December 10, 2020

Comments

  • user2492364
    user2492364 over 3 years

    I'm trying to use git clone to download the codes from my webfaction server

    $ cd ../webapps/nameofwebapp/
    $ git clone [email protected]:github-username/github-repo.git ./
    

    AND there is error :

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

    I use ls and there are something under the nameofwebapp

    auth  git.cgi  gitweb.cgi  repos  static
    

    I want to ask where to use git clone Do I need to make a new directory??

  • user2492364
    user2492364 almost 10 years
    it works but seems it clone the wrong branch.there are tow branches on git.master and develop.and I want to clone develop
  • user2492364
    user2492364 almost 10 years
    now my git branch only have "master".I want to delete it and retry your "git clone [email protected]:github-username/github-repo.git -b develop ./" can you teach me how to remove the github-repo directory
  • VonC
    VonC almost 10 years
    @user2492364 you can remove the folder. But I have fixed the checkout command. Give it a try.
  • VonC
    VonC almost 10 years
    @user2492364 yes, the clone command clones all branches in the origin namespace. You just need to create the one you need from one of those origin/xxx branches.