Reference: http://blog.csdn.net/q199109106q/article/details/8655204
The actual use is organized as follows:
Create a code base that stores the code uploaded by the client
Create a new SVN directory under the/USER/SVN directory, which can be created later in the SVN directory
Open terminal, create a myCode, enter command:svnadmin create/users/svn/mycode
After the command executes successfully, it will find a/users/svn/mycode directory on the hard disk;
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], such as:
[Users]
# Harry = Harryssecret
# sally = Sallyssecret
Zhangqing01=123123
Zhangqing=123123
Account Number: zhangqing Password: 123123
3. Open Authz, configure user groups and permissions
Users who are added to the passwd can be assigned to different groups of users and can later set different permissions for different groups of users without having to set permissions individually for each user.
Add a group name and user name under [groups], separated by commas (,) between multiple users;
[Groups]
# harry_and_sally = harry,sally
# Harry_sally_and_joe = Harry,sally,&joe
Topgroup=zhangqing01,zhangqing
[/]
@topgroup =RW
ZHANGQING01 and zhangqing are all belong to topgroup this group, then the permission configuration.
Use [/] on behalf of all repositories in the SVN server, such as configuration instructions Topgroup All users in this group have read/write (rw) permissions to all repositories, the group name is preceded by @
If it is a user name, do not add @, such as zhangqing this user has read and write permissions
[/]
Zhangqing=rw
4. Start the SVN server
Enter the following command at the terminal:svnserve-d-r/users/svn
or enter:svnserve-d-r/users/svn/mycode
Silent instructions to start successfully
5. Close SVN server
Search for SVN in Activity Monitor, find svnserver, Force end process;
SVN client Use
1. Import code from local to server (first initialize import)
Enter in the terminal
SVN import/users/svn/ios http://localhost/mycode/iOS--username=zhangqing--password=123-m "Initialize import"
Explanation: Upload all contents of /users/svn/ios to the server Mycode/ios directory, "Initialize import" is a comment
2. Download the code from the server side to the client local
Enter svn checkout Http://localhost/mycode/iOS--username=zhangqing--password=123/users/desktop/ios in the terminal
Explanation: Check out the contents of the Mycode library in the server to the /users/desktop/ios directory
3. Commit the changed code to the server
In step 2, the server-side code has been downloaded to the /users/desktop/ios directory, modify some of the code inside, and then commit to modify the server
Navigate to /users/desktop/ios directory, enter:CD /users/desktop/ios
Input directive:SVN commit-m "modified main.m file"
Explanation: All changes under /users/desktop/ios are synchronized to the server side,"modified main.m file" as comment log
4. Update the server-side code to the client
After locating the client code directory in the terminal, such as the /users/desktop/ios directory, enter the command:SVN update
5. Add the client's code to the server
After locating the client code directory in the terminal, such as the /users/desktop/ios directory, enter the command:svn add "file name"
In the Execute command: SVN commit-m "Add File"
6, delete the client's code to the server
After locating the client code directory in the terminal, such as the /users/desktop/ios directory, enter the command:svn delete "file name"
In the Execute command: SVN commit-m "Delete file"
7. For other uses of SVN, you can enter in the terminal:svn Help
Mac comes with SVN usage notes