Summary:
In the home PC, when the company uses the office computer to modify the code of a project, it encounters the problem of code synchronization. This article explains the workarounds for Code synchronization and automatic deployment.
Implementation method:
1. First install SVN (sudo yum install svn) on Linux servers and Linux.
2. Then create a repository on the service and configure users and permissions, this online method is more, self-Baidu.
3. Synchronize with the SVN command on the Linux client, as follows:
SVN Co svn://(IP address) (folder where files are saved) # #检出版本库. The first time to enter a user name and password.
Copy the Code (project) that needs to be synchronized to the checked-out folder.
SVN add * # #添加文件, this may appear svn:e200009: Because some of the targets are versioned, you cannot add all the targets and execute the SVN add *--force Force addition.
Then execute $ svn commit-m "log" to upload into the library and automatically deploy (automatic deployment is explained below) # #log to modify the log
4.window is simple, directly download SVN, tube home has. After installation, in the right-click menu there are SVN checkout options, select Check out, and then enter the user name and password is OK.
Automatic Deployment method:
1. Go to the Linux repository under SVN, locate the Hooks folder, and enter. The files here are some scripts that will be executed automatically after an operation.
2. Execute command CP Post-commit.tmpl Post-commit
3. Execute command chmod 777 post-commit modify file permissions
4. Execute the command vim post-commit open the file, clear the existing content, add the following statement:
Export LANG=ZH_CN. UTF-8 # #设置编码方式
SVN=/USR/BIN/SVN # #设置svn路径, note not project path
App=/root/test # #设置目标路径, which is where you want it to be deployed automatically after you synchronize the code
${SVN} Update ${app}--username (your user name)--password (your password)
5. You are done.
PS: The first time to write a Bo, welcome correction
Methods for using SVN synchronization and automatic code deployment between Windows, Linux and Linux servers