Answer the question
In order to leave comments, you need to log in
How to set up git on your own server and replace sftp work with it?
Hello!
I work with the server via sftp, I changed the file in the IDE, pressed ctrl + s, the file went to the server.
I want to have a history of file changes.
Is it possible to do something like the following?
Let's say this structure on the server
/var/www/site.ru/git
- here is the repository
/var/www/site.ru/www - here is the site
it was possible to connect via ssh, but only execute git commands.
In the IDE, I press strl + s, the changes are sent to the server, captured by git, and after that git sends the changed files to the www folder.
Thanks for answers.
Answer the question
In order to leave comments, you need to log in
Yes, you can. For example, I have everything set up via ssh. Create a gitusers group on the server and include the users you want to give access to. Create a directory, for example /opt/git , create your repositories there and set the permission for this group to read / write.
Here everything is described in detail - https://raymii.org/s/tutorials/Shared_Git_reposito...
To view repositories and organize group work, you can put www.redmine.org or https://trac.edgewall.org/ (or else a bunch of stuff)
Or you can just install gitweb - https://git-scm.com/book/ru/v1/Git-%D0%BD%D0%B0-%D...
You can also install a complex solution like https:/ /about.gitlab.com/install/
The repository should not be located on the same server as the application itself, it is better to keep the history of changes separately. The easiest way is to do git init at the local workplace, commit there, and upload to the server in the old fashioned way via sftp (and preferably always completely deleting and overwriting files).
If you don't want the sources with the history to be only on the local machine, you can synchronize them somewhere outside to services like github, gitlab, bitbucket.
You can start using git and still upload files via ftp.
Install the https://github.com/git-ftp/git-ftp extension and you will be able to push your changes via ftp. Only changed files will be copied.
Installation and use are trivial: https://habr.com/post/178067/
Just keep in mind that the server will not have a full-fledged git repository - only files, so if you have a local one, then there will be nowhere to clone from.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question