Executing the command git clone git@github.com:whatever
creates a directory in my current folder named whatever, and drops the contents of the Git repository into that folder:
/httpdocs/whatever/public
My problem is that I need the contents of the Git repository cloned into my current directory so that they appear in the proper location for the web server:
/httpdocs/public
I know how to move the files after I've cloned the repository, but this seems to break Git, and I'd like to be able to update just by calling git pull
. How can I do this?
Make sure you remove the .git repository if you are trying to check thing out into the current directory.
rm -rf .git
thengit clone https://github.com/symfony/symfony-sandbox.git
If you are using
ssh
forgit cloning
you can use the following command.git -C path clone git@github.com:path_to_repo.git
eg:
git -C /home/ubuntu/ clone git@github.com:kennethreitz/requests.git
would pull the git repository forrequests
to your/home/ubuntu/
path.Option A:
Option B:
move the .git folder, too.
Better yet:
Keep your working copy somewhere else, and create a symbolic link.
Usage
Clone the repository located at the <repository> onto the local machine. The original repository can be located on the local filesystem or on a remote machine accessible via HTTP or SSH.
Clone the repository located at <repository> into the folder called <directory> on the local machine.
Source: Setting up a repository
To clone to Present Working Directory:
git clone https://github.com/link.git
To clone to Another Directory:
git clone https://github.com/link.git ./Folder1/Folder2
Hope it Helps :)
If you want to clone into the current folder, you should try this: