I had this same need. In my case I had a standard web folder which is created by a web server install. For the purposes of this illustration let's say this is
/server/webroot
and webroot contains other standard files and folders. My repo just has the site specific files (html, javascript, CFML, etc.)
All I had to do was:
cd /server/webroot
git init
git pull [url to my repo.git]
You need to be careful to do the git init in the target folder because if you do NOT one of two things will happen:
- The git pull will simply fail with a message about no git file, in my case:
fatal: Not a git repository (or any of the parent directories): .git
- If there is a .git file somewhere in the parent path to your folder your pulled repo will be created in THAT parent that contains the .git file. This happened to me and I was surprised by it ;-)
This did NOT disturb any of the "standard" files I have in my webroot folder but I did need to add them to the .gitignore file to prevent the inadvertent addition of them to subsequent commits.
This seems like an easy way to "clone" into a non-empty directory. If you don't want the .git and .gitignore files created by the pull, just delete them after the pull.
ls -a
do you see a.git
directory?