My student party, now developing with several classmates, plans to use git
Git has built a bare warehouse and hooks can be automatically synchronized to web projects.
Since the code on the server is not a warehouse, I now want to import the code from another server to the bare warehouse and then let the team members pull it. How to do it? I think of the way is to pull the code to the local first, and then push it from the local to the central warehouse. because of the automatic synchronization, the central warehouse automatically synchronizes the push code to the web project. But personally, there should be a better way. Please inform?
Is the warehouse used by general git the whole project? Or is it part of the project? If it is the whole project, the user uploads the picture, then it is not that the uploaded picture has to be updated to the local place every time it is updated.
I have searched for a long time and seldom talked about this aspect. Please explain it in detail.
Hello, now our team has a problem in the project, because there was a bug in the project during 5.1, a classmate modified the bug at home, but his computer was not equipped with git, so he uploaded it using ftp. At present, since ftp is used for uploading, the post-reveice that has not been used in the central warehouse will naturally not trigger hooks and will not be pushed into the website project. therefore, it is impossible to get the part uploaded by git now. So the problem now is that I have to write one more hooks. Once changes are made on the website project (if it is uploaded by ftp), pull it to the central warehouse, and then obtain it locally. The central warehouse and the website project can be synchronized in two directions. Perhaps this is not a very good way for us to do it, but for the time being we can only do it. Of course, I also hope that the great god’s answer is to provide a good way by the way. Thanks again
The description of the problem is not very clear. Let me briefly explain what I understand.
The method of migrating code is no problem.
Generally, the warehouse used by git is the whole project and may contain some submodule.
What you said about users uploading pictures is actually another problem. Have you synchronized the git project warehouse to the server and used it as a directory for web projects?
If yes, there will be a little problem. First of all, it is better to use git warehouse only for development. As for publishing and deploying web projects, jenkins and other work are used. The specific process is as follows:
Project developers use operations to trigger github’s webhook, such as push code, tag, etc.
Github requests your deployment tool according to the webhook configuration and notifies your deployment tool to further execute the release action.
The deployment tool pull down the latest code to the code directory, package the web project through scripts or commands, generate a new web project directory, and publish it to the server.
In this way, the user’s picture is uploaded to the project directory in the server instead of the git code directory, so there is no need to worry about updating the uploaded picture.
In addition, using the code warehouse as a web project to publish may have security problems. If the access control is not good, others may get the files in your git project and may leak some information.