Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm a small business and for the most part only use git locally to track history then SFTP the files to the remote server.

I now have a much larger more complicated build that to be set up properly requires a production, a staging, and a development server.

I'm trying to set up git so I can merge changes from development and push/pull to the staging environment for deployment testing, then again to production.

So far, I've installed git on production and development. I've also created a Repo via Bitbucket and commit/pushed the contents of my httpdocs folder to master. I thought this would mean I can simply clone then branch directly into my httpdocs folder on development.

However, when I tried to pull these files into the development environement to make the development branch it included a folder with my project name(I never created this folder). I ended up with httpdocs/MyProjectName/Files

My questions are:

  1. Did I do something wrong in setup?
  2. Is there a way to configure git so it knows I want the files not the containing directory?
  3. Can I clone in a way that only pulls the contents of MyProjectName but not the directory?

I don't want my workflow to include pull then copy to httpdocs.

share|improve this question
are there files in httpdocs that aren't in your repo? – skarface Sep 9 '13 at 21:17
I initially thought the OP misspelled "gitbucket" - turns out there's an actual project behind it. – Isxek Sep 9 '13 at 22:02
@skarface no there aren't – Bms85smb Sep 10 '13 at 3:23
@Isxek I did make a typo. I'm referring to – Bms85smb Sep 10 '13 at 3:27
up vote 7 down vote accepted
git clone [repository] [local path]

If your working directory is your desired destination, simply put a .

$ git clone .
share|improve this answer
Thanks, I'll try this tomorrow! I have a feeling it will work. It seems all to obvious. – Bms85smb Sep 10 '13 at 3:30
This worked. Thanks! – Bms85smb Sep 10 '13 at 15:10
Note: the directory you want to clone into, here called [local_path], must be empty – Alf Jul 14 at 10:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .