The company needs to configure the svn server in the past two days, but I used checkin checkout before. I have little knowledge about SVN itself. I just took this opportunity to take a look at it. The content is very simple, so don't laugh.
#{
// V0.2
I thought about changing the template to a more comfortable one. :) Today, we have made new progress again. Some of them did not make it clear yesterday. Now we have made the first revised version, but it may not be too detailed if it is too late.
// V0.3/110407
I jumped from 0.2 to 0.3. It wasn't my research that went deep,... We found a Lili collabnet subversion edge. Please skip to Supplement 5 before reading the article.
#}
Because we do not know much about Linux, we configure the server in windows. In fact, it is an ordinary xp pc. In fact, it is my own saiyang development machine --#, since we only have four computers and there are not many projects, it should be enough. If I want to configure them in Windows, it should be roughly the same. In Linux, it seems similar.
First, I searched for SVN. First, I understood the basic concepts. SVN was hosted on an HTTP server. I have a SVN Chinese manual on the svn Chinese site. Thank you.
Generally, SVN servers use svnsever and Apache for hosting. The former is lightweight, and the latter is heavyweight. I don't fully understand the Web. It seems that everyone is using Apache, I went to the Apache site to get the no SSL version. Let me know why. By the way, it seems that some Chinese enterprises have provided image downloads for Apache, and even some shameless users, Khan. I hope more and more Chinese enterprises will not only ask for images, but also make contributions, collect more Rp.
Search for SVN and go to the svn official main site. People say that this website has expired. What are you going to do? Go to the new official site. -- Well, let's go to the new site, pay attention to the getting subversion-Binary packages on the left. Click and select windows. If you see no, there are multiple options. There are four SVN packages. Let's talk about them here, SVN itself is a program with no interface, which is difficult to use. These versions are packaged, some contain Web servers, and some have graphical interfaces, in short, it makes it easier to use visual SVN. Many people like visual SVN. It seems that the graphic interface is quite friendly, but it may need to be cracked. I have chosen collabnet SVN and nnd for a great deal of effort to understand the relationship between collabnet SVN and SVN. Alas, collabnet SVN contains an Apache and is integrated with SVN, you don't need to configure too much later. That's great. Some people say that using apache2.2 with Svn in Windows may cause problems, but I have not encountered it. It seems that there is another viewvc in collabnet SVN, but I didn't get it up. It needs python2.5. I only went to the python official website for 2.7, And the python used in Windows seems to have something to do, I don't know what it is, it's 2.6,--, shit. I tried it and failed. Let's get down to the truth. Now we know why we don't need to go to Apache separately. Come on. Now let's install collabsvn. well, don't be afraid. Right, double-click and next. Then there will be a place in the middle where you want to select the svn_repository directory. The directory name should start at will. I suggest you keep the directory too deep. OK, I chose D: \ svn_repository. I don't need to worry about anything else, port 80 and port 3690. I won't use viewvc. Then I have installed it. I have to restart my computer. This is required, apache and SVN are started as services. You can see them in Windows management tools. The installation directory of my program is d disk, which is as simple as converting C to D. It is very useful to remember the installation directory of the program. Let's start to configure it. At first, I referred to this article. This article is very practical, but it seems to be a fight. I also made a detour. Now I will summarize it with my experience, the most difficult thing to get started with SVN is not an operation, but a conceptual understanding.
Concepts:
About SVN Directory: first, the svn_repository we selected earlier is not the svn directory. This directory is called svnparentpath. In fact, svnpath exists, but it is advantageous to use the Parent concept, because we may have many SVN source code repositories. Now, for example, we have a C # software repository and a Java software repository. We can't always mix these projects together, so we have to have at least one CS software warehouse and one Java software warehouse. Now, I will explain it using examples.
About the svn Repository: Remember not to use the concept of Windows Resource Manager to run to the svn_repository folder and right-click "create folder" to create a directory. Do not copy any files, at least for now, this is silly. I started to make a detour. SVN management is actually database-based management, and you cannot see any projects, files, or folders. The folders you create in SVN are actually like creating folders in databases, you cannot see it in the resource manager. Do you understand? Well, if you don't understand this concept, you 'd better not continue.
SVN is more like a database management software. Each source code repository is a database.
Relationship with the Web server: I am not quite clear about this. It seems that the HTTP transmission protocol is used and can be managed on the web page. SVN also has its own protocol. Others are really unclear, for more information, see the official documentation.
In addition:
You need to turn off your firewall now. Whether it's windows or soft, We are Intranet and there is no security problem. If you have security requirements, you can turn to a professional.
You do not need to set svn_repository as a shared folder.
Now let's start. The remaining work is mainly to rewrite the configuration file, that is, to perform plain text operations. Here, editplus is strongly recommended for ease of use. In addition, every time you change the configuration file, you need to restart Apache, which is very simple and fast. You do not need to restart your computer. The method will be discussed later.
Don't bother me. It's about to get started. I 've been tossing around for two days. You have done everything before. I told you to remember the installation directory of collabnet. Now you find it and enter a directory where you will find the httpd directory, the following is the Apache directory. Find apachemonitor, Which is graphical on the Apache console. Can you see it? Open it first, and you will see apache/2.2.15 (win32) SVN/1.6.12dav/2 at the bottom, and you will often use the restart button later, this is used to restart Apache.
# In the configuration file indicates the meaning of the comment.
Now you need to go to the conf directory in the httpd directory, open the httpd. conf file in the text editor, find line 84th
84 # loadmodule dav_module modules/mod_dav.so
85 # loadmodule dav_fs_module modules/mod_dav_fs.so
Remove the lines before the two lines. Of course, the number of lines is for reference. The content prevails. Actually, I don't know if to remove the lines #. 84 is definitely required.
Then find the 115 rows
115 loadmodule dav_module modules/mod_dav.so
116 loadmodule dav_svn_module modules/mod_dav_svn.so
You know, remove #. It seems to be the same as above, But I really cannot control this stuff. If I repeat it, there should be no side effects.
Add row 116 under row 117th. Note that this is important.
Loadmodule authz_svn_module modules/mod_authz_svn.so
Save and open it again
After pulling the file to the end, you will see the <location/SVN> flag. We need to modify the code here, but now we are not in a rush. Turn off first.
We need to first establish the source code repository (in fact, we can also create the source code repository without the command prompt line. We can use the little turtle for convenient graphical operations. I will mention it when talking about the little turtle, however, we recommend that you use the command prompt to help you better understand the problem .)
The installation directory of collabnet is under the D drive program files, and the svn_repository directory is D: \ svn_repository. you can do it yourself, now I want to build two source code repositories: CS and Java.
Run-cmd to open the command prompt
Then
Enter D: Enter
Enter cd d: \ Program Files \ collabnet \ Subversion server and press Enter.
Enter svnadmin create d: \ svn_repository \ Cs and press Enter.
This is a CS software repository. By the way, if you want to delete this software repository, you can simply delete the CS folder.
Enter svnadmin create d: \ svn_repository \ Cs and press Enter.
This is a Java software repository.
Then select a software repository and assign the conf folder to the folder to D: \ svn_repository. Then we will not use the conf folder in each software repository, I will not use multiple conf files separately. conf is the configuration file for various account permissions. Of course, if you only have one software repository, you can directly use the conf file in the repository. This is just a personal habit, you need to understand and use it flexibly. No matter where you use the conf file, we need to modify it. You must be patient.
I won't draw ASCII pictures, so envy others --.
Now you have to design the directories, roles, permissions, and configuration files of each SVN software repository, you can refer to its syntax.
Look at my design. There are three folders, project, demo, and temp, under each CS and Java software warehouse. There are several project directories, such as projecta and projectb, under the projects folder, mainly for formal projects. There is also the demo Directory, which stores some demo projects. There is also a temp folder to store anything.
Role: Manager, CS programmer, Java programmer, and poor intern.
Managers can read and write all directories. CS programmers can only read and write files in all Cs software warehouses. Java programmers can only read and write files in all Java software warehouses.
CS programmers can read only the demo folder under the Java software warehouse and read and write temp under the Java software warehouse without any other power.
Java programmers can read only the demo folder under the CS software warehouse and read and write temp under the CS software warehouse without any other power.
Poor interns can only read the demo folder under each software warehouse, and can read and write the temp folder under each software warehouse.
Now, don't worry about it. After the design is complete, pause it first, return to the conf directory in the httpd directory, and open httpd in a text editor. in the conf file, pull down the file and locate the <location/SVN> tag. do not find it.
You don't need to worry about Dav SVN.
If you see this line of svnpath, You Need To comment out or delete it. It does not coexist with svnparentpath. We need to have a line.
Svnparentpath D: \ svn_repository
This is mine. You can refer to your own.
Authtype basic is not required
Authname "My SVN" is the name of the svn server.
Then the two rows are very important.
Authuserfile D: \ svn_repository \ conf \ passwd
Authzsvnaccessfile D: \ svn_repository \ conf \ authz
Still, this is mine. If you look at your own directory, you should be able to understand it.
The last line is require valid-user.
This is the content in the tag. Okay, save it, close it. Let's go back and enter D: \ svn_repository \ conf.
Open svnserve. conf in a text editor
Find [general]
Set the following
Anon-access = none
Auth-access = none
Password-DB = passwd
Authz-DB = authz
Note # Remove the comments before the four rows. The first and second rows are anonymous users and the permissions for authenticating users, but I didn't understand it. I changed it to none.
Some people say that the comments in the line realm = my first repository are also removed. I didn't understand what it meant. I removed it.
Open the passwd file in a text editor.
Find [user]
Then add account = PASSWORD below
No doubt, it is plain text.
I added,
Admin = Admin
Manager = 12345
Cscoder1 = 12345
Javacoder1 = 12345
Student1 = 12345
Let's look at the roles I designed earlier. I should know the meanings of these accounts. Admin account is required. It is a super administrator account.
= Can be changed:
Save, close, and then open the authz file.
Find [groups]
Add
G_admin = admin, Manager
G_cscoder = cscoder1
G_javacoder = javacoder1
G_student = student1
This is to set the user group and save it. Next we will specify the power of each user group, or in this file, just add it below.
[Cs:/]
@ G_admin = RW
[Cs:/projects]
@ G_admin = RW
@ G_cscoder = RW
[Cs:/demo]
@ G_admin = RW
@ G_cscoder = RW
@ G_javacoder = r
@ G_student = r
[Cs:/temp]
* = RW
[Java:/]
@ G_admin = RW
[Java:/projects]
@ G_admin = RW
@ G_javacoder = RW
[Java:/demo]
@ G_admin = RW
@ G_javacoder = RW
@ G_cscoder = r
@ G_student = r
[Java:/temp]
* = RW
Save, close, OK, you have done it. Congratulations.
* = RW indicates that any role can read and write data.
* = Indicates that any role has no permissions.
Restart Apache now. Don't forget how to do it.
Open your browser, such as IE, and enter 127.0.0.1. It works will be displayed!
Congratulations, it indicates Apache is normal, and then start 127.0.0.1/SVN
The system will prompt you to enter the account password. In fact, it is useless if you lose. Forbidden is displayed. In fact, D: \ svn_repository is opened remotely, but we didn't provide access to D: \ svn_repository power, of course, is rejected, you need to be clear, of course, I do not understand the Web, just understand this point.
Enter 127.0.0.1/SVN/CS and press Enter.
Enter 127.0.0.1/SVN/Java and press Enter.
You can replace 127.0.0.1 with your intranet IP address. Of course, localhost can also be used. Once again, the firewall is shut down.
This is the real access to the svn repository, namely the access to the CS repository and the Java repository. It seems that you can enter 127.0.0.1/SVN to enter the default SVN repository, but I won't figure it out.
After entering the account and password, you can normally see the file structure. If no, uh, yes, I haven't said how to create a directory in the svn repository yet. --
If an error is prompted, go to D: \ Program Files \ collabnet \ Subversion server \ httpd \ logs \ error. log.
Now, we want to create a directory. Although we can use command line to create a directory, we have a better choice. We need to use a very convenient graphical tool that can manage SVN, tortoisesvn, search for it and find its official website. If you choose download, it seems that it is a group of visual SVN. If you don't care, find the current version, I downloaded the 32-bit version and installed it after the download. I have nothing to say. It will take you to restart after the installation. Don't go crazy. Just do it.
Okay, you have restarted. Now you are happy. You can find a folder, a blank area, or a blank area on the desktop, right-click it and see what you have found. Haha, I will not talk about it. You choose repo-browser and enter
127.0.0.1/SVN/CS or 127.0.0.1/SVN/Java
Did you see it? Right-click, create folder... Fill in the name, and create the projects, demo, and temp folders respectively. Both software repositories must be created. The menu functions are clear at a glance, so I will not go over them. Now the server configuration is complete.
There are two common source code warehouse structure design modes, which are actually two management concepts. You need to choose the appropriate one. For the two common directory design methods, I will not go over it here. You can view this article. Another article is great!
For more information about Apache and permission configuration, see this article.
There are also two posts worth recommending: Portal 1 and portal 2.
Here I have to say that iusesvn is really a good Chinese community for SVN.
There are also three words about trunk, branches, and tags. These three directory names can all be called. You don't have to worry about them. They are actually a name, it is used for display. It is more used to express a management philosophy. For more information, please search. I have disabled the webpage, so there is no way to provide a portal.
Finally, I have finished writing about the server. -- #, it's so tired. I'll write something short later, and it's not complicated, alas. Let me take a break.
Here, I will add how to use the turtle to easily create the source code repository. For example, I want to create another source code repository named CPP, first in D: \ svn_repository right-click the new folder and name it CPP. For example, you can use Windows Resource Manager to enter the D: \ svn_repository \ CPP folder and right-click the blank area, select tortoisesvn-creaate repository here. How is this simple.
Continue.
Let's talk about the concept of SVN plug-ins in eclipse and.
The Eclipse plug-in is subclipse, And the vs plug-in is called ankhsvn. The names are strange, but they are easy to use. The vs plug-in supports even 2010.
Subclipse and ankhsvn are things of the same level as tortoisesvn, both of which interact with the svn server and can be retrieved from the project and submitted to the project, but each has its own advantages. The first two depend on IDE, which can automatically identify which files need to be submitted and which do not need to be, and the menu is integrated into IDE, which is very convenient. By convention, it seems that vs is more stupid, the turtle has nothing to do with IDE, but it is recommended that the turtle be installed without conflict.
Open the first expired SVN home page, and pay attention to the lower left corner. See no. There are eclipse and Visual Studio under subversion and IDE.
There are many versions of eclipse. Note that generally 3.3 and 3.4 use the subcliipse of 1.6x. I will not talk about the installation of Eclipse plug-ins in general search. I downloaded the zip package for installation, do not decompress the package during installation. Import and install the package and install all the projects. You can use the package after installation. Open windows, open perspective-other, and then you will see the svn resource library research. Now you can check it out on the project. Generally, export and import are not used, which is not good or bad.
Ankhsvn under vs has good compatibility. You can download the latest version to install the next step. The usage is similar, but it seems that vs plug-ins are not as powerful as Eclipse and turtle, and turtles are essential. Right-click the project to see the svn menu, or open the project from SVN, which is quite simple. Common functions are to submit changes, check out, and lock.
V0.2
Supplement 1:
View the version Library (source code repository) in the parent folder ).
What does this mean first, that is, when you open 127.0.0.1/SVN, you can see all the source code repositories in the browser and open them.
First, open the conf directory in the httpd directory and use the text editor to open httpd. conf. If you forget where to go, you can view the previous content and locate the <location/SVN> tag. You must make some modifications first.
1. Change <location/SVN> to <location/SVN/>
2. Add a line svnlistparentpath on under the line of svnparentpath.
3. You need to add an access permission to the authz file. For example, if you want the admin user group to access this page, add
[/]
@ G_admin = r
[/] Indicates the Directory D: \ svn_repository.
When you open the webpage, enter 127.0.0.1/SVN,
Instead of 127.0.0.1/SVN, is it clear?
In this way, we can easily view the source code repository in the browser.
I learned from this.
Supplement 2:
You can also set permissions like this,
[/]
Admin = r
Set permissions for one user separately, instead of a user group.
[Aliases] In the authz file can be used to set aliases, for example
[Aliases]
AD = Admin
In the subsequent configuration, & ad is equivalent to admin, for example
[/]
& Ad = r
I did not understand the sample. I do not know whether [aliases] supports regular expressions or whether it supports user group aliases.
Supplement 3
If you want to use Chinese characters in the source code repository, use editplus to convert the configuration file to UTF-8 format storage without Bom, and use NotePad to save it as a conversion file with Bom. For more information, see here.
For more information about character sets, see this article. In addition, there is an article by James Lin.
Supplement 4
The account password in the passwd file can not only be converted into plain text, but also be encrypted using MD5. This requires the Apache tool htpasswd under the httpd/bin directory to generate files and add accounts.
Usage:
Open the command prompt, that is, CMD, locate the httpd/bin directory, and then
Input
Htpasswd-CM d: \ passwd user1 // use the htpasswd command to create the first user (user1) and generate a password authentication file. The C parameter is create, and the M parameter is MD5 encryption, you will be prompted to enter the password.
New Password :******
Re-type new password :******
Adding password for user user1 // the user is successfully added.
Then, you will find the passwd file under D: \. Let's just move it to the D: \ svn_repository \ conf directory and replace the original passwd file, you can open it and check whether it is encrypted.
How can I add an account?
Assume that you have not moved the created passwd file.
Htpasswd-m d: \ passwd user2 // use the htpasswd command to create the second user (user2). Note that if the C parameter is added, the user and file created earlier will be overwritten.
New Password :******
Re-type new password :******
Adding password for user user2 // the user is successfully added.
No. The C parameter is used when the file is created for the first time. Pay attention to it. I am too lazy, so I will use the directory D: \ passwd as an example. You can do it in one step.
Attached
Parameters of the Apache htpasswd command
-C. Create an encrypted file
-N: If the encrypted file is not updated, only the user name and password encrypted by the Apache htpasswd command are displayed on the screen.
-M by default, the Apache htpassswd command uses the MD5 Algorithm to encrypt the password.
-D the Apache htpassswd command uses the crypt algorithm to encrypt the password.
-P Apache htpassswd command does not encrypt the password, that is, the plaintext Password
-S Apache htpassswd command uses Sha algorithm to encrypt the password
-B enters the user name and password in the Apache htpassswd command line instead of entering the password as prompted.
-D. Delete the specified user.
In Windows, the '-m' option is the default in Netware and TPF systems. You can ignore it when using the Apache htpasswd command. In other systems, the '-p' option may not work.
I don't know what the consequences of using M and P together. Let me know. --
I wrote it here first, and it may be revised later, but it is not certain. If you have time, I 'd like to try to understand the configuration in viewvc and Linux. I hope it will help you. Good night. :)
Supplement 5 // v0.3
I don't know when the collabnet subversion edge came into being. It's very sharp. Let's take a look at the introduction. A certified software stack containing the latest versions of subversion, Apache, and viewvc,
Yes, people include viewvc, Python runtime environment, and Apache. viewvc seems to be used to view code repository and other information on the Web, there is also a SVN management tool on the web page, which is awesome and doesn't have to be hard-pressed any more. Of course, if you need complicated account and permission configurations, you still need to learn how to write the configuration. It's also a matter of writing it in the white --#.
See http://www.collab.net/downloads/subversion/ for details and downloads
It seems that the product collabnet subversion has finally been taken shape. It is really great and very nice, and it is still growing. I hope the features will enrich human nature in the future.
Supplement 6 // v0.3
In addition, let's take a quick look at the Classic branch, trunk, and tag directory settings. Our company currently has three directories under each project. Trunk stores the main line of the project, the most important place, branch stores the branch of the project, such as the OEM version software and new function test version. The tag is used for release. The code here is not changed and corresponds to the release version of your software. In a hurry, I checked the statement here. I agree with the previous statement in the article.
Although there is no mandatory rule, it is also an agreement. At least you can understand it when others use it. If you have any better method, you may wish to use this method. Of course, I don't know what to do in complicated situations. I will talk about it later when I have experience.
PS: Our boss said that most people use it like this. Others are either cainiao or masters. --#