Home > Development Tools > git > body text

Look, SVN can be used between the virtual machine and the host machine.

咔咔
Release: 2020-06-24 16:35:29
Original
2575 people have browsed it

As programmers, we should still try more. When writing rabbitmq, it is difficult to take screenshots because it is operated in a virtual machine. In order to present you with more information, Good results, so I will write an operation process for using svn between the host and the virtual machine.

This article mainly focuses on the following aspects

  • Install svn
  • #Use svn to connect the virtual machine on the host machine
  • Hook synchronization to the web directory
  • Use svn for multiple projects
  • svn user permission settings

Implementation environment of this article

  • centos7.3
  • All operations are in the virtual machine

1. Install svn

Execute command: yum install subversion

Execute svn --versionView version number, check whether the installation is successfulLook, SVN can be used between the virtual machine and the host machine. Create a public directory for the repository, and create an svn directory under /var/mkdir /var/svn

Of course, this directory can be customized, depending on personal habits Look, SVN can be used between the virtual machine and the host machine. Then go to the var/svn directory and create a version library

Execute the command svnadmin create /var /svn/kaka, at this time there will be a blog repository in your svn directory (don’t worry about the other two files, they will be used later when doing svn management of multiple projects)

Look, SVN can be used between the virtual machine and the host machine. Enter the repository of kakavar/svn/kaka/confYou can see three files

auth: file that controls permissions passwd: file that controls passwords svnserve.conf: configuration information for svn Look, SVN can be used between the virtual machine and the host machine. Modify the svnserve.conf configuration information, just change the ones circled in red. Look, SVN can be used between the virtual machine and the host machine. Next set the password and open the file passwd Look, SVN can be used between the virtual machine and the host machine. Look, SVN can be used between the virtual machine and the host machine. Set permissions, here is the role followed by the user name set by the user Look, SVN can be used between the virtual machine and the host machine. Then change the passwd# you just modified Move the ## and authz files to the same directory as the repository, and execute the command mv passwd authz /var/svn At this point, the installation and configuration of svn is completed. Next, we will explain the svn between the host and the virtual machineLook, SVN can be used between the virtual machine and the host machine.

. Second, the svn between the host and the virtual machine

When using the virtual machine, you must pay attention to the IP address

The host first needs to have an svn client. I won’t go into this installation. The next step will be ok. Look, SVN can be used between the virtual machine and the host machine.

Open the svn service, execute the command svnserve -d -r /var/svn/, and check whether it is opened successfullyLook, SVN can be used between the virtual machine and the host machine. The host starts to connect, the address is the IP address of the virtual machine, and the account password is admin 123456 and that's itLook, SVN can be used between the virtual machine and the host machine. At this point the file has been cloned locallyLook, SVN can be used between the virtual machine and the host machine. The test uploaded the file was also successfulLook, SVN can be used between the virtual machine and the host machine. At this point we connected svn to the host and submitted the file to svn successfully.

3. Implement automatic synchronization to the web environment

Because the web directory is not configured in the virtual machine, it is directly in /usr/local/nginx /html

Change post-commit.tmpl under /var/svn/kaka/hooks to post-commit Look, SVN can be used between the virtual machine and the host machine. Execute the command mv post-commit.tmpl post-commit and give full permissions Look, SVN can be used between the virtual machine and the host machine. Modify the contents of the post-commit file, but after opening the file, there is a bunch of Comments, Kaka prompts a command to delete them all

Execute 100 dd, which means deleting 100 linesLook, SVN can be used between the virtual machine and the host machine. and adding some content

#!/bin/sh #设定环境变量,如果没有设定可能会出现update报错   export LANG='zh_CN.UTF-8'    SVN_PATH=/usr/bin/svn WEB_PATH=/usr/local/nginx/html/kaka/   LOG_PATH=/tmp/svn_update.log $SVN_PATH update $WEB_PATH ~
Copy after login

Look, SVN can be used between the virtual machine and the host machine. Save and exit, we will submit a new file locally, Create a new 456.txt file and submit it Look, SVN can be used between the virtual machine and the host machine. Go to the web directory to see if there is a file /usr/local/nginx/html.

It is obvious that this file does not exist, don’t panic! Look, SVN can be used between the virtual machine and the host machine. In the directory /usr/local/nginx/html, execute the command in the last step of the operation:

svn co --username admin --password 123456 svn:/ /192.168.254.135/kaka

, at this time our host’s files have been cloned to our virtual machine through svn. Upload it locally again to see if it can be directly uploaded to the virtual machine. Look, SVN can be used between the virtual machine and the host machine.After testing, it is already ok.

Look, SVN can be used between the virtual machine and the host machine.

4. Using svn in multiple projects

In fact, in the screenshot above, I can see that there is a

blog

in my version library version of. <p data-tool="mdnice编辑器" style="padding-top: 8px;padding-bottom: 8px;line-height: 26px;margin-top: 10px;margin-bottom: 10px;font-size: 14px;word-spacing: 2px">The operation steps are exactly the same as the <code style="overflow-wrap: break-word;margin: 0px 2px;font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;color: rgb(53, 148, 247);background: rgba(59, 170, 250, 0.1);display: inline-block;padding: 0px 2px;border-radius: 2px;height: 21px;line-height: 22px">kaka version library. Just delete the passwd and authz files directly under blog/conf

, that is, use multiple versions of the library Same permissions and account password Look, SVN can be used between the virtual machine and the host machine. Upload a 258.txt to kaka and blog at the same time Look, SVN can be used between the virtual machine and the host machine. Look, SVN can be used between the virtual machine and the host machine. At this point, you can use the same svn for multiple projects.

5. User permission settings

Why do you need to set this user permission distinction.

For example, if you transfer the code to svn, then a new colleague comes to the company. He needs to be familiar with the code, but he can only pull the code and cannot submit the code.

At this time, user permissions need to be set. Let’s get started

Login user new Look, SVN can be used between the virtual machine and the host machine. At this time, only r permission is available. New user without w permission cannot submit files Look, SVN can be used between the virtual machine and the host machine. Look, SVN can be used between the virtual machine and the host machine.

The above is the detailed content of Look, SVN can be used between the virtual machine and the host machine.. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
svn
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template