tags:

views:

13247

answers:

4

Executing the command git clone [email protected]:whatever creates a directory in my current folder named whatever, and drops the contents of the git repo 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 repo, 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? And thank you!

+15  A: 

Option A:

git clone [email protected]:whatever folder-name

Option B:

move the .git folder, too.

Better yet:

Keep your working copy somewhere else, and create a symbolic link.

Can Berk Güder
I hadn't thought of your 'Better yet' option, and I like it although I'm not sure why. What are the advantages of this?
BigDave
It probably doesn't provide any advantage right now, but it might save you a lot of trouble if you decide to move stuff around some day.
Can Berk Güder
I'm trying the symbolic link method, but I'm not sure if this will work with Django?
Sam S
+2  A: 

When you move the files to where you want them, are you also moving the .git directory? Depending on your OS and configuration, this directory may be hidden.

It contains the repo and the supporting files, while the project files that are in your /public directory are only the versions in the currently check-out commit (master branch by default).

Paul
+3  A: 

The example I think a lot of people asking this question are after is this. If you are in the directory you want the contents of the git repository dumped to, run:

git clone [email protected]:whatever .

The "." at the end specifies the current folder as the checkout folder.

J Wynia
A: 

In my hands, the suggestion below does not work:

% git clone [email protected]:.git . fatal: destination directory '.' already exists.

This is in OS X, git 1.6.0.6

There seems no option to silence the objection.

One reason to want to do something like this is to let Xcode set up a project and then clone an existing repo into the folder. I don't try to maintain Xcode project files in the repo (just *.m, *.h, *.nib, etc). Xcode seems to insist on creating a folder when you initiate a project, and I have not seen any way to override that.

Randy Zauhar
Same here. I'm getting the same error om Ubuntu 10.10 Git 1.7
Sam S