Using Svn in MAC for project management, drawing on the http://blog.csdn.net/q199109106q/article/details/8655204
The following solutions are available for tests by multiple users
Reprinted please indicate the source: http://blog.csdn.net/yc7369
In Windows, we generally use tortoisesvn to build the svn environment. In Mac environments, because Mac comes with SVN server and client functions, we can use the svn function without installing any third-party software, however, a simple configuration is required.
Let's first look at how to build the svn server environment in the Mac environment.
Create a code repository to store the code uploaded by the client
Create a SVN directory under the/user/Apple directory, and then create multiple repository directories under the svn directory.
Open the terminal, create a mycode repository, and enter the following command:Svnadmin create/users/Apple/SVN/mycode
After the command is executed successfully, the directory/users/Apple/SVN/mycode is added to the hard disk. The directory structure is as follows:
Configure SVN User Permissions
It mainly modifies three files in the/SVN/mycode/conf directory.
1. Open svnserve. conf and remove the # And space before the following configuration items.
[Java]View plaincopyprint?
- # Anon-access = read
- # Auth-access = write
- # Password-DB = passwd
- # Authz-DB = authz
# anon-access = read# auth-access = write# password-db = passwd# authz-db = authz
Anon-access = read indicates that anonymous access is read-only. If you change to Anon-access = none, anonymous access is prohibited. You need an account password to access the service.
2. Open passwd and add the account and password under [users], for example:
[Java]View plaincopyprint?
- [Users]
- Mj = 123
- JJ = 456
[users]mj = 123jj = 456
The account is MJ and the password is 123
3. Open authz and configure user groups and permissions
We can assign users added in passwd to different user groups. In the future, we can set different permissions for different user groups, and there is no need to set individual permissions for each user.
Add the group name and user name under [groups]. Multiple users are separated by commas (,).
[Java]View plaincopyprint?
- [Groups]
- Topgroup = MJ, jj
[groups]topgroup=mj,jj
It indicates that both MJ and JJ belong to the topgroup, and then Configure permissions.
Use [/] to represent all the resources in the svn Server
[Java]View plaincopyprint?
- [/]
- @ Topgroup = RW
[/]@topgroup = rw
The configuration above indicates that all users in the topgroup have read and write permissions on all resource libraries. The group name must be prefixed @
If the user name is used, @ is not required. For example, MJ has read and write permissions.
[Java]View plaincopyprint?
- [/]
- Mj = RW
[/]mj = rw
For other fine-grained permission control, refer to other content in the authz file.
4. Start the svn Server
The most important thing to do is to check whether the server can be started normally. If the server cannot be started, it is futile to do more work.
Enter the following commands on the terminal:Svnserve-d-r/users/Apple/SVN
Or enter:Svnserve-d-r/users/Apple/SVN/Mycode
If no prompt is displayed, the startup is successful.
5. Shut down the svn Server
If you want to disable the svn server, the most effective way is to open the "activity monitor" in the utility"
Based on the above, we can easily build the svn server environment.
Use SVN client functions
1. Import code locally to the server (initial import)
Enter
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 command: Upload all the content in/users/Apple/documents/eclipse_workspace/Weibo to the Weibo directory of the mycode repository on the server, "initialization import" in double quotation marks is a comment
2. download code from the server to the local client
EnterSVN checkout SVN: // localhost/mycode -- username = MJ -- Password = 123/users/Apple/documents/code
Download the content of the mycode repository on the server to the/users/Apple/documents/code directory.
3. Submit the changed code to the server.
In step 2, you have downloaded all the server-side code to the/users/Apple/documents/code directory. modify the code in the directory and submit the modifications to the server.
1> open the terminal, locate the/users/Apple/documents/code directory, and enter:CD/users/Apple/Documents documents/code
2> enter the submit command:SVN commit-M "modified the main. M file"
This command will synchronize all the modifications under/users/Apple/documents/code to the server. If this time I only modified the main. File
You can see the print information of the terminal:
[Java]View plaincopyprint?
- Sending Weibo/Main. m
- Transmitting file data.
- Committed revision 2.
Sending weibo/weibo/main.mTransmitting file data .Committed revision 2.
4. Update the server code to the client
This should be the simplest command. After locating the client code directory in the terminal, such as the/users/Apple/documents/code directory above, then enter the command:SVN update
5. For other SVN usage, you can enter:SVN help
A large number of SVN commands are listed here. The content in the brackets below generally represents the short name of the command. For example, we can use svn ci instead of SVN commit and SVN Co instead of SVN checkout.