2

I have an issue with a new remote repository that when cloned using Tower, doesn't clone all the directories.

When I created the remote repository, I did the following:

  1. Created a .gitignore file containing the following line

    files/cache/*

  2. Then ran:

    git init git add . git commit

  3. I then cloned the remote repository to my local machine using a Mac OSX git client called Tower but noticed that many of the directories did not clone.

When I go back and look at my terminal session on the webserver, I can see the directories that weren't cloned listed after the initial commit - I see a whole bunch of lines that look like this:

create mode 10644 directory-name/path/to/file.php
create mode 10644 directory-name/path/file.php
create mode 10644 directory-name/path/to/file.php
create mode 10644 directory-name/path/file.php

So I'm guessing they were added but I'm also wondering if my .gitignore file is not setup right and is conflicting with Tower somehow?

I tried the .gitignore file a couple of ways, firstly like this:

files/cache/*

then like this:

files/cache/

After changing it to the second one, I ran git add -A (which didn't seem to add anything new) on the server and pulled the repo down using Tower again - but no luck.

Not sure if this is Git or Tower or both - not sure what I'm doing wrong, sorry.

Any help would be much appreciated.

Cheers

Ben

skaffman
  • 398,947
  • 96
  • 818
  • 769
CMSCSS
  • 2,076
  • 9
  • 28
  • 49
  • What happens if you try the same thing using the command-line `git` client on OS X? – larsks Oct 04 '11 at 03:18
  • Thanks for that - Sorry, it took me a while to work out how to do that (couldn't work out the user and address) but it looks like an issue with the remote repository as all the directories don't clone via the command line. Is there a way to force Git to add to the missing folders to the remote repositry or troubleshoot the issue on the server? Any help would be much appreciated. Cheers – CMSCSS Oct 04 '11 at 03:43
  • If I add a missing directory and go `git status` it says 'nothing to commit (working directory clean)' – CMSCSS Oct 04 '11 at 03:51

1 Answers1

1

Don't forget that git won't add (and clone) empty directories.
(or directories with ignored content, making them empty for Git)

See:

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Thanks mate - that was it. It's a bit of pain though as the CMS will need these directories to write files to from time to time. – CMSCSS Oct 04 '11 at 04:01
  • @CMSCSS: so you know you can add dummy 'keeper' files within those directories, in order for them to be kept in the Git repo, right? As explained in the second link of my answer. – VonC Oct 04 '11 at 05:45
  • Thanks mate, particulalry liked the way of adding .git ignore files to empty directories automatically: `find . -type d -empty -exec touch {}/.gitignore \;` – CMSCSS Oct 05 '11 at 05:24