Using Git with a Samba shared folder

user1032531 picture user1032531 · Apr 16, 2014 · Viewed 10.6k times · Source

I am new to Git, and trying to determine how to best implement it.

I have the following four machines:

  1. Linux server running GitLabs which stores my main repository.
  2. Linux production server running Apache, etc. I am not currently concerned about this part.
  3. Linux development server running Apache, etc. It also runs Samba and maps /var/www to Windows. It is located in my home and is on a LAN.
  4. Windows 7 PC running a PHP IDE (happens to be PhpED). It is located in my home and is on the same LAN as the Linux development server. It directly edits the files in the Samba folder on the Linux development server, as well as uses this folder for debugging, and does not have code directly on it. The IDE has some basic Git functionality via TortoiseGit, however, I don't yet know how strong it is.

I am currently not concerned about sharing files, but only version control.

I've read that Git is all about being local. Giving my configuration, does that mean Git is run on the Windows PC even though my working directory is not located on it? Or is it handled just using Linux between /var/www/ and the GitLab repository? How do you envision I implement Git under this configuration?

Thank you

Answer

Oliver Matthews picture Oliver Matthews · Apr 16, 2014

Git works on files. With the way you describe it, you will be running git on your windows pc - the fact the files are actually being accessed via the network rather than directly is something git probably won't even be aware of. As long as that is the only machine accessing that share, it should be fine.

But it's not really how you should use git. It has it's own mechanism for pushing/pulling changes between machines; so unless you are running an interesting driveless setup, you should probably consider storing the working directory on the machine that it is being edited on. Especially if there is a chance the files could be accessed from the linux machine as well (mixing version control accesses to the same working directory between multiple machines is always a bad idea, let alone between multiple OSes.