Nroot Nroot - 1 year ago 69
Git Question

Trying to use a git repo on a share drive but cannot access files with apache or windows explorer

Set up:

I'm using codeigniter and xampp, no issues with apache setup, ports are open, I can get to the xampp default dashboard from another computer's browser on the local network with no problem. SSH has been setup through Cygwin, https is enabled.

What I am trying to do:

I'm trying to set up a git repository on a share drive that a host computer, which is hosting the internal website, has access to. Ideally the website files will be stored on the shared drive and accessed by the host computer when it receives a request to display a page. I want these files to be part of a git repository that I and a co-worker can push and pull to/from. I know that you can set up a git server, but I'm trying to find a quicker, less complicated solution.

What I have done so far:

-Created a bare repository on the shared drive R:\Data\db

-Opened the repository through windows explorer and seen the git repo files (hook, info, ref, and etc) size:1.54 MB

-Cloned the bare repository to my computer

-populated the repository with CodeIgniter on my computer, committed, and pushed to the share drive repo R:\Data\db (no errors) (16.2 MB)

-Opened the repository again through windows explorer, but there are no added files, repo on share still 1.54 MB R:\Data\db

-Gone to host computer, cloned the share repo from R:\Data\db onto it's hard drive, and magically the CodeIgniter files are pulled down from somewhere. (16.2MB)

-checked the share drive again, still no files but the basic repo files

-Set up httpd conf through apache to look for the share drive files at R:\Data\db\CodeIgniter, and regardless of capitalization Apache fails to restart as it can't find the directory.

-I've set up "net use r: \server-path\drive-name" properly as far as I can tell, it's got to be correct because I was able to create the blank repo in the first place.


The repo exists somewhere, I can access it from multiple computers, I'm using the correct server directory path (unless I'm not, but then that's flummoxing on a whole other level), but apache can't find the files, nor can windows explorer. I'm going slightly crazy trying to figure this out, does anyone know what the issue might be?

Answer Source

OKAY. Figured it out.

So the bare repo where the files are magically being stored is located at R:\Data\db.

I then cloned that Repo to R:\Data\website (the files, again, magically [or as I have discovered in lots of learning, not so magically] appeared). So the Cloned repo is at R:\Data\website\db

Next, I created a hook in the --bare repo at R:\Data\db\hooks, of the post-receive variety like so:


echo attempting auto update...
GIT_WORK_TREE=R:/Data/website/db git checkout -f

I saved it with an '.exe' extension (post-receive.exe), added a random text file to the repo on my local drive, and then pushed from my computer like normal to the repo at R:\Data\db.

The hook fired and the files in R:\Data\website\db got updated to include the random text file! WOOOOOO!

I pointed apache's httpd.conf file's DocumentRoot to R:\Data\website\db and the server is now displaying the webpages properly! and every push is reflected in the working product!

Thanks to these sources:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download