Use of the SVN command line in the "Go" Mac Environment

Source: Internet
Author: User
Tags anonymous svn client svn update

Reprint Address: http://blog.csdn.net/itianyi/article/details/8981989

In a Windows environment, we typically use TORTOISESVN to build an SVN environment. In a Mac environment, because the Mac comes with SVN's server-side and client features, we can use SVN without any third-party software, but we need to do a simple configuration.

Let's start by looking at how to build an SVN server-side environment in a MAC environment.

Back to top one, create a code warehouse to store the code uploaded by the client

I'll start by creating a new SVN directory under the/user/apple directory, and then you can create more than one repository directory in the SVN directory.

Open terminal, create a mycode warehouse, enter command: Svnadmin create/users/apple/svn/mycode

After the command executes successfully, it will find a/users/apple/svn/mycode directory on the hard disk, the directory structure is as follows:

Back to top second, configure user permissions for SVN

The main is to modify the/svn/mycode/conf directory of three files

1. Open the svnserve.conf and remove the # and spaces in front of the following configuration items
# anon-access = read# auth-access = write# password-db = passwd# authz-db = Authz

Anon-access = Read on behalf of anonymous access, if you change to anon-access = None means anonymous access is forbidden, the account password is required to access

2. Open passwd and add your account and password under [users]
[users]mj=123
jj=456

The account number is MJ, the password is 123.

3. Open Authz, configure user groups and permissions

We can assign the users in the passwd to different user groups, later, you can set different permissions for different groups of users, there is no need to set permissions for each user individually.

Add a group name and user name under [groups], separated by commas (,) between multiple users

[GROUPS]TOPGROUP=MJ,JJ

Note that MJ and JJ belong to the Topgroup group, and then the permissions are configured.

Use [/] to represent all repositories in the SVN server

[/] @topgroup =RW

The above configuration instructions Topgroup all the users in this group have read and write (rw) permissions for all repositories, and the group name is preceded by the @

If it is a user name, do not add @, such as MJ This user has read and write permissions

[/]MJ=RW

For other fine-grained permission controls, you can refer to other content in the Authz file

4. Start the SVN server

Before the configuration of so many, the most critical or to see whether the normal start of the server, if not to start, do more work in the front is futile.

Enter the following command at the terminal: svnserve-d-R/USERS/APPLE/SVN

or enter: Svnserve-d-r/users/apple/svn/mycode

Without any hint, it means the boot was successful.

5. Close the SVN server

If you want to shut down the SVN server, the most effective way is to open the utility's "Activity Monitor"

Together, we can easily build an SVN server environment.

Back to top three, using the SVN client feature 1. Importing code locally to the server (first initialize import)

Enter in the terminal

SVN Import/users/apple/documents/eclipse_workspace/weibo Svn://localhost/mycode/weibo--USERNAME=MJ--password=123 -M "Initialize import"

I explained the meaning of the instruction: upload everything in the/users/apple/documents/eclipse_workspace/weibo to the Weibo directory of the server Mycode warehouse, followed by the "Initialize import" in double quotes is a comment

2. Download the code from the server side to the client local

Enter SVN checkout Svn://localhost/mycode--USERNAME=MJ--password=123/users/apple/documents/code in the terminal

I explain what the instruction means: Download the contents of the Mycode repository in the server to the/users/apple/documents/code directory

3. Commit the changed code to the server

In step 2, the server-side code has been downloaded to the/users/apple/documents/code directory, now modify some of the code inside, and then commit these modifications to the server

1> Open terminal, first locate to/users/apple/documents/code directory, enter: Cd/users/apple/documents/code

2> Input Submission Instructions: SVN commit-m "modified main.m file"

This command will synchronize all changes under/users/apple/documents/code to the server side, if I only modified the main file this time.

You can see the print information for the terminal:

Sending        weibo/weibo/main.mtransmitting file data. Committed Revision 2.

4. Update the server-side code to the client

This should be the simplest instruction, in the terminal to locate the client code directory, such as the above/users/apple/documents/code directory, and then enter the command: SVN update

5. For other uses of SVN, you can enter in the terminal: SVN help

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

Go to the SVN command line using the MAC environment

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.