NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
How to best use Git with PhpED?


Joined: 27 Nov 2009
Posts: 98
Reply with quote
I've asked similar questions other places, and am hoping to get a more PhpED perspective.

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

I have the following three machines:

Windows 7 PC running a PhpED 12.0. It is located in my home and is on a LAN.
Linux development server running Apache, etc. It is located on the same LAN as the above PC.
Linux production server running Apache, etc. I am not currently concerned about this part.

I actually have a 4th Linux server running GitLab for my repository, but I expect this will be the same as if I was using GitHub or something similar.

I've mapped /var/www on the Linux development server using Samba over to the Windows PhpED PC. Is this a good way to do it? And don't try the opposite and map the Windows folder over to the Linux server, right?

If I share the working directory on the Linux server with the Windows PhpED PC, do I run Git on the Windows PC or the Linux development server to commit/add/etc with the repository? Or do I need to do both? When I've asked similar questions, I get "Git really isn't suppose to work that way".

Please feel free to provide any additional clarification/insight/advise as I am totally confused.

Thank you
View user's profileFind all posts by NotionCommotionSend private message
Guru master

Joined: 24 Jul 2009
Posts: 737
Reply with quote
This is probably one of those areas where opinions will vary and I'm certainly not a Git expert.

I think mapping with Samba is correct; it should be more efficient for the web server file access and I have a gut feeling it is probably more secure & manageable.

Personally I use SmartGitHg on Windows, which has some nice features. It provides a very useful UI to the underlying Git tools.

Git can manage the repository using the normal file system, so if you have direct local or network access to the files, you don't require a Git server or anything special, just the Git tools. That was one of the design concepts of Git; for personal repositories a special Git server is not required. You would use the Git tools from wherever is most convenient.

If you are primarily using Windows for development (despite the files maybe being on Linux) then using Git from Windows seems to make sense.

There are some notes in these forums about integrating the base Git tools with PhpED, using scripts and shell commands. For me, I just run SmartGit off to one side and I'm very happy with that.

Typical work scenario for me:

* Check project status using SmartGitHg to see I haven't committed any changed files to the repository, or ignored files that I do not want to commit.
* Do my edits testing, etc. optionally committing at intervals if I feel I've reached a particularly goal. These regular commits allow me to review issues if I break anything.
* Final commit at the end to my personal repository.
* If in a shared project situation then also consider committing back to the central repository and obtaining other peoples latest commits (push/pull/merge).
View user's profileFind all posts by plugnplaySend private message


Joined: 27 Nov 2009
Posts: 98
Reply with quote
Thanks plugnplay,

I have received many answers to this question on various forums (sorry, tried to post links, but this forum doesn't allow to prevent spam), and everyone is different. I even submitted a ticket to NuSphere (see below). I don't think this solution makes sense as I believe Tortoise Git requires Git on Windows. Agree?

Quote:
Dear Michael, thank you for writing in. Unfortunately this is really unrelated to PhpED - your question seems to be very much about how Git works on Shared Windows drive. It is not clear also whether your plan is to run Git on Windows or on the source Linux box (we would guess Git works much better on Linux). All we can say that Tortoise Git should work fine integrated with PhpED, there should be no problem. We would suggest that the questions about setting up Git Repo with shared drive would be better addressed on Git forums, or just googling in and checking stackoverflow is a very good bet.

Hope it helps, Support


I have had multiple responses not to use a shared Samba folder at all as "Git was not designed to work that way" and that "I should have separate local repositories on the PC and development server" on , but shared Samba folders sure makes PhpED's file uploads easy and I would like to use them.

I am sure SmartGitHg works well, and I have heard good things about SourceTree. The drawback as I see it is that I need to do my work on PhpED, then go to the 3rd party client to check for changes, then stage them, etc, instead of staging them from within the PhpED environment. I could also run Git on the Linux box instead, however, then I will need to do similarly and even worse first SSH onto it before doing so.

While the PhpED's response is correct that my questions are not specifically PhpED related, I feel it is an important enough topic a recommended example in the documentation or a whitepaper or something.

Any other advice or suggestions would be very appreciated.
View user's profileFind all posts by NotionCommotionSend private message
Guru master

Joined: 24 Jul 2009
Posts: 737
Reply with quote
For my own work environment, whilst I use a Samba share to access the Linux server, I'm the only person accessing it. So there are no issues with multiple people (a team) accessing that same Git repository and that is maybe what people are referring to; I believe the whole concept of these Git repositories are that they are effectively private and not shared, before committing to a central truly shared repository.

I also have both Windows Server 2003 (older projects) and 2012 (newer projects) as development/staging servers, both accessed in a similar way from PhpED.

My PhpED computer does not have any project files stored on it; there is nothing for me to commit on the PhpED computer. I use SmartGit from the PhpED computer to manage the Git repository that is stored on the shared drive, plus it can also push commits to a remote repository.

It sounds like you are referring to a private Git repository only accessed by you but on a shared drive? I'm not sure why that would be considered a problem, unless people assume you are referring to a shared repository, because you said it is on a shared drive.

It is true that file access over a shared drive from PhpED & SmartGit is slower than local storage, but local storage does not work for me and I certainly haven't found performance bad.

The Samba share seems faster than a Windows share, plus the Linux Apache is a lot faster than running Apache from Windows, so my clients get a much faster web site response time when they are reviewing the site.

I allow some of my clients to directly access the development servers and see progress.
View user's profileFind all posts by plugnplaySend private message


Joined: 27 Nov 2009
Posts: 98
Reply with quote
Thanks pluginplay,

Do you have Git running on the Linux server, the Windows PC, or both?

I currently have it running on both, and I haven't had any big problems yet, but see some differences when running commands on the two platforms (Windows sometimes shows a file being modified twice).

I am thinking having it running on both is not a good idea. My reason is Git on both machines will be looking for changes in the directory and attempting to update the hidden Git directory and associated database. Does this make any sense?

So if it has to be one or the other, which machine?

To you TortoiseGit, I believe I need to run it on the Windows PC. The problem with this is my Linux server needs Git to run GitLab, and I don't know how to tell configure Git on one machine not to track a given directory, but to still do so on the other machine.

Any thoughts? Thank you
View user's profileFind all posts by NotionCommotionSend private message
Guru master

Joined: 24 Jul 2009
Posts: 737
Reply with quote
I just run SmartGitHg on Windows; nothing on Linux. My own Git requirements are relatively simple; for management of my own personal developments.

Probably the private .Git repository directory within the project should only be accessed by a single Git tool at any time. With the Git server on Linux, you might have to run Git just on Linux.

Others would have to confirm this, but would a normal Git scenario be something like:

* You have your development project and your private Git repository; only you access that Git repository, not the server. That might also be an accessible development server to allow full testing. It is not staging, because you will potentially have test data.
* When you are happy with your developments you push them to the central repository, which is the one the Git server manages. That repository probably would not be used for running a staging/development service as it needs to remain more 'pure'.
* The staging server would pull from the central repository.

So you have two separate Git repositories and file bases?
View user's profileFind all posts by plugnplaySend private message
How to best use Git with PhpED?
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic