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.
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:
Configure user permissions for SVN
The main is to modify the/svn/mycode/conf directory of three files
1. Open svnserve.conf and remove the #和spaces in front of the following configuration items
[Java]View Plaincopy
- # 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], such as:
[Java]View Plaincopy
- [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
[Java]View Plaincopy
- [Groups]
- Topgroup=mj,jj
Said MJ and JJ are belong to topgroup this group, then the permission configuration.
Use [/] to represent all repositories in the SVN server
[Java]View Plaincopy
- [/]
- @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
[Java]View Plaincopy
- [/]
- 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"
By combining the above, we can build the SVN server environment easily.
using the SVN client feature
1. Import code from local to 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:
[Java]View Plaincopy
- Sending WEIBO/WEIBO/MAIN.M
- Transmitting 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
Original: http://blog.csdn.net/q199109106q/article/details/8655204
Use of SVN in Mac environment