GIT setup with remote server

I currently have my files located on a remote Linux server that I can access via a mounted folder. Of course, I also have a copy of all of the files on my local PC for PhpSorm to operate on. When I set this up, I created a GIT repository on my remote server (cloned from the master on BitBucket.org). I am wondering if this is the "proper" approach, or whether I am better served making the GIT repository be on my local PC with a copy of the files on the remote server? Or, should I just have a GIT repository in both places? I am not a GIT expert, so I am looking at what the best approach would be to using GIT in a development environment with PhpStorm on my PC and a remote server running Apache..

I have downloaded a nice GIT GUI (SourceTree) and tried it using my current configuration. It is quite slow when working on the remote server using my mounted folders. However, when I put the same repository on my local PC it is very fast, which is why I started thinking about chaning my approach.

Any help would be appreciated!

Jim

1 comment

I typically setup clones on both my development server and my local box.  I can test via regular SFTP and make sure I'm happy, then commit locally.  When I feel it's ready for true alpha testing, I run git clean -fd and git reset --hard and git pull on the development box.  If everything still looks good that means the code I committed is working properly.  After that your workflow may vary, but I have a staging server for my clients, and I'll typically pull it up there and make sure they're happy, then do the final merge and call it done.

Using a centralized repository hub like BitBucket makes it pretty simple since both clones point to the same place.  Just create yourself a single remote branch, check it out locally and track it on your dev server and your local environment, and you're good.

Your mileage may vary, but it's been working for me for a long time :)

0

Please sign in to leave a comment.