Build and configure the SVN server environment under MAC (except for the display image, all commands are available under Linux/unix)

Source: Internet
Author: User
Tags configuration settings svn svn client

These days the leadership did not arrange work, idle nothing to want to take their own two years to do the iOS development sense of the lack of knowledge of the place want to take a deep tutorial, yesterday and today plan to learn the next SVN and git from the creation and to the principle, to the command, to the use of the interface. Accidentally being found by another leader, I'm studying this, look, I'm okay. I want to help her group to change the SVN permissions, I am also very happy, can let oneself learn the things to come in handy that is how lucky, and she also let me more believe ready to be slaughtered, always better than waiting to die, at least can sell a price (smile).

Most of our development companies are using VISUALSVN to build Code version control server environments under Windows, which I'm already familiar with. But today, I learned that the company's version control is hosted under Linux, full of confidence a little bit discount, but fortunately, I have the characteristics of the almighty although sometimes I am not professional, but sometimes I can come in handy (proud), now in the company dry iOS development of me, In fact, two years before the Linux system administrator, so believe that a little familiar with the SVN command should not be a problem, so a bite and stomp on the easy to pick up the live.

By understanding that the use of SVN under Linux is basically the same as in the MAC environment (I'm proud to have used some SVN commands for iOS), and the Mac also has a built-in SVN server and client tools (a rare experience with a Mac superiority), However, most versions of the Linux system need to install their own SVN server tools (if you have time to feel I will install the Linux system to play and then write a Linux installation svn method, currently you can refer to these two: Yum Install SVN method/HTTP/ www.cnblogs.com/jiqing9006/p/3370627.html or source file installation method: Linux under the SVN installation configuration http://www.cnblogs.com/xd502djj/archive/2011/ 01/21/1941404.html). Since the command, I am too lazy to build a Linux environment, anyway, this job does not need me to start from the beginning, the direct use of my Mac to experiment. The nagging person breaks down to read a circle, starts to do the matter!

Build an SVN server and build a code warehouse

First we create an SVN server directory, as the total SVN code directory, you can later build more than one warehouse directory. Here I create the directory/user/jackiehoo/documents/svnserver. Enter the command:

mkdir ~/documents/svnserver

And then we'll start working in this directory, I'll create a svntest repository here, enter the command:

Svnadmin Create/users/hoojackie/documents/svnserver/svntest

After the execution of the instruction, we can find that there are more/users/hoojackie/documents/svnserver/svntest on the hard disk, directory structure

If you see a similar directory where your code warehouse is created, the next step is to configure SVN.

Configure user permissions for SVN

Notice the Conf directory in which there is a three file Authz, passwd, svnserve.conf, which manage most of our SVN configuration settings. Let me introduce the common configuration, you can refer to the SVN manual.

1. Configure the Repository configuration file

Go to conf directory, enter command

VI svnserve.conf

Open svnserve.conf, will be the following content in front of the # and space (be sure to shelf, do not have a space, otherwise it will be a problem, remember Ah, pro) removed.

# anon-access = Read  # authwrite    # passwordpasswd    # Authz 

wherein, anon-access = Read for anonymous access when the time is read-only, if the anon-access = None to prohibit anonymous access, requires an account password to access; auth-access = Write gives authorized users permission for writing; password-db = passwd indicates the password file path; uthz-db = Authz access control file.

2. Configure the user

Open passwd Config file: Enter conf directory, enter command

VI passwd

That's how I changed it.

Under [users], configure the SVN account you want to add, = the left side of the equals sign indicates the user name, and the right represents the password.

Finally, we can set permissions for users and groups in the Authz file.

Open the Authz file, enter the Conf directory, and enter the command:

VI Authz

We can add the user we previously added to the group under [groups] line. = The left side of the equals sign is the group name, the right is the user name, and multiple users are separated by commas (,). For example, I set up a group, three groups Manager,ui,web.

[groups= = = Wanger,mazi

The group is configured, then we need to set user and group access to the warehouse. Continue editing the Authz file. For example, I set it this way.

[/]   = == r

By this time our SVN basic configuration is complete, and now we just need to start our SVN server. (Busy day, success or failure is stake).

Start our SVN server

Enter the following command at the terminal:

Svnserve-d-r/users/hoojackie/documents/svnserver

or enter:

Svnserve-d-r/users/hoojackie/documents/svnserver

Haha, I just knocked out this command without any hint, if you are also, the rep should start successfully. We can look at the Mac's Activity Monitor:

Process exists, indicating that we have successfully built our SVN server environment. You also watch the click of the exit process to close the SVN server.

Testing with the SVN client

Test 1: Test pour code from local to server

Here I'll go ahead and use the command line, of course, you can also use the Interface tool test. I took one of my personal projects, Dingdingin. Import to SVN server as a native code (this work is usually initiated by the technical lead in the actual project for the first time the project is initialized, I am here to put myself into a bit (smile)).

In the terminal input command

SVN import/users/hoojackie/documents/development/momentslife\ (Tintin)/momentslife\ (Tintin's imprint)/SVN://  Localhost/svntest/momentslife--username=jackiehoo--password=jackiehoo-m "First initialize import code"

The previous path represents the path of the local code, the right directory represents the directory path of the remote SVN server, here I test locally, so is localhost, in the real world you need to replace the remote SVN server IP address.

Then if you see a similar effect, on behalf of the code you are uploading:

Actually, the first two times I knocked on this command. Error message:

Svn:E170001:Authorization failed

The reason is that when I configure Authz access to directory permissions, we have the @ symbol in front of the group name. So if you also encounter this error, please check that the user name, group name, and other settings are correct.

After uploading, you will see committed revision 1. The words, the upload was successful. Congratulations to you here. But don't take it easy on your guard and let the other members test their read and write permissions. Please try it for a reference. Here are a few more you need to test I do not one to do.

Test 2: Download code from server side to client local

(Pending completion)

Test 3: Test the changed code to the server

(Pending completion)

Test 4: Update the server-side code to the client

(Pending completion)

Other uses of SVN

For other uses of SVN, you can type in the terminal: SVN help

Here's a bunch of SVN instructions, and the rest of the parentheses will generally represent the abbreviation for the instruction, for example, we can use SVN ci instead of SVN commit and SVN co instead of SVN checkout.

Build and configure the SVN server environment under MAC (except for the display image, all commands are available under Linux/unix)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.