Home >Development Tools >git >Look, SVN can be used between the virtual machine and the host machine.
❝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.
❞
Execute command: yum install subversion
Execute svn --version
View version number, check whether the installation is successful 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 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)
Enter the repository of kaka
var/svn/kaka/conf
You can see three files
auth: file that controls permissions passwd: file that controls passwords svnserve.conf: configuration information for svn Modify the svnserve.conf configuration information, just change the ones circled in red. Next set the password and open the file passwd
Set permissions, here is the role followed by the user name set by the user 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 machine
The host first needs to have an svn client. I won’t go into this installation. The next step will be ok.
Open the svn service, execute the command svnserve -d -r /var/svn/
, and check whether it is opened successfully 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 it At this point the file has been cloned locally The test uploaded the file was also successful At this point we connected svn to the host and submitted the file to svn successfully.
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
Execute the command mv post-commit.tmpl post-commit
and give full permissions 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 lines 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 ~
Save and exit, we will submit a new file locally, Create a new 456.txt file and submit it 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! In the directory /usr/local/nginx/html
, execute the command in the last step of the operation:
, 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.
After testing, it is already ok.
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 Upload a 258.txt to kaka and blog at the same time At this point, you can use the same svn for multiple projects.
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 At this time, only r permission is available. New user without w permission cannot submit files
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!