Search code examples
gitsshconsoleclonehost

Cloning a git repo to /home/public and not /home/public/exampleproject?


I have clone a github repo onto my web server using ssh, but when I did it created a sub folder instead of pulling the files to the 'root' folder. For example, when using:

cd /home/public
git pull GITEXAMPLEHERE

Puts the files in /home/public/GITEXAMPLE HERE, when I really want to put the files pulled not into its own subfolder, but into /home/public. I have looked around, and it seems to be an easy fix but I can not find anything on it.


Solution

  • You can clone directly to a directory ("." in your case).

    See the following usage of "git clone" (or by typing typing "git clone" on your console):

    git clone [options] [--] <repo> [<dir>]
    

    So in your case that would be:

    git clone GITEXAMPLEHERE .
    

    After that you can use git pull and git push in the current folder.

    Alternatively, you can move your files, including the ".git" directory to any other directory you want (if you cloned to the wrong folder).