Using Git with a Samba shared folder
Asked Answered
S

1

6

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

Shani answered 16/4, 2014 at 12:47 Comment(0)
A
3

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.

Avruch answered 16/4, 2014 at 12:54 Comment(2)
But it's not really how you should use git. I have heard that before, and it is exactly why I am in such a quandary. The problem is the files need to be on the Linux development server for debugging. If I put them on the Windows PC as well, then they are multiple versions everywhere. Maybe I should investigate mapping them from Windows to Linux?Shani
Actually, I'd consider one of two options: 1. ssh onto the development machine and run the git commands there 2. use --git-dir to move the .git dir onto the windows machine while leaving the development files mapped. Although as long as only your dev machine will be performing git operations on the share, it is OK to put the git dir there.Avruch

© 2022 - 2024 — McMap. All rights reserved.