Answer the question
In order to leave comments, you need to log in
How to sync site files from local PC to server?
I make websites and I have long been concerned about the issue of synchronizing what I wrote with the working version on the server. Is there a ready solution for my task? Perhaps someone is already using ready-made solutions that I cannot find, because. maybe I don't know the right way to ask Google.
I have, in principle, a working solution to this problem, but it seems to me that there are more elegant solutions.
I have:
- Site(s) on a personal computer (win) that are running on Denver. They are used in the process of writing a site
- Working sites on the server (*nix).
- main language - php
Required:
- upload new and changed files from the working computer to the server.
- control files deleted from the server and be able to upload them again
- delete files from the server that were deleted on the working computer
- (desirable) the ability to create backup files on the server (previous version of the site) and quickly restore, if necessary
- (desirable) be able to
- be able to take into account file filters (blacklist, greenlist) - the rules of what can be downloaded and what can not. Filters can also be of the form /path/to/*/ignored/files
- a minimum of data should be transmitted over the network. That is, ignore ignored data and, if possible, compress the stream. This is due to the use of not very fast internet.
Standard solutions working via FTP and SSH do not suit me, because the site can have a very advanced folder structure, and there can also be folders containing thousands of files. With this solution to update one or two files, the entire site directory is scanned, which takes a lot of time. Problems also arise when there are folders with thousands or even hundreds of thousands of files that do not need to be synchronized.
Perhaps, in some cases, git will suit me, but, as far as I understand, it needs to be installed on the server. If I make a website on my server, then installing the necessary software is not a problem. But if you need to transfer the site to the customer's server and maintain it, then difficulties arise, because. it can also be shared hosting, where the admin will not install third-party software or there may be no access via SSH. In this case, I can no longer use git.
At this time, for many years now, my solution has been to install a script on the site that performs synchronization. The process looks something like this: Changed the file (s). You need to upload them to the server. I run the script on the local machine through the browser (i.e. access mylocalsite/sync.php).I click "get list" and I see a list of new, changed files (checking by file time), deleted ones (either removed from the local version or added to the server). Further, I send those files that need to be updated to the server. If there are a lot of files, then I can throw all the changes into the "upgrade" server folder, and then immediately update everything all at once.
Please suggest ways to solve the problem.
Answer the question
In order to leave comments, you need to log in
If Git doesn't work just because you can't install it on the server, then try Git + git-ftp. Git is only needed on the local machine, and git-ftp only uploads/removes files that have changed since the last sync. The server only needs FTP.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question