Git services are now unique, with more flexibility than SVN, the most popular open source project hosting site GitHub above, if hosted open source projects, then is free to use, but closed-source projects will charge an expensive fee, if you are not short of money, you can skip.
Git server setup under Windows platform
installation of Java and configuration of environment variables
Slightly.
gitblit Download and install
: http://www.gitblit.com/. The downloaded software can be extracted directly, without installation.
The extracted files directory can be set by itself.
Create a folder to store your data.
gitblit Configuration
Run
- First visit
Run the Gitblit.cmd batch file under the Gitblit root directory.
Browser access.
Enter the Administrator account admin/admin login.
You can modify the login password and suggest changes.
- To create a version library
Create a repository, click the Create Repository in the drop-down menu, or manage it from the repository on the page.
Enter a name, the specific access policy and the initialization content default, according to the actual needs change.
Creating an empty version of the repository is successful, and the page has some hints and commands for users to use to push content to the repository.
This does not use Admin account admin for push, we push the content to the repository by configuring new users on the client side (that is, clients). This is also more in line with the actual production, the admin account is only used to manage the server site, do not participate in actual business. This includes creating the repository and granting permissions to the user later by configuring permissions. Next, create a user.
- Create user
Click users in the drop-down menu.
Click Add Users in the top right corner, go to the Details page, fill in the general information.
The property page is filled in and optional, depending on the situation.
Access Permissions page to configure repository permissions.
1). Select the repository and select Test.git.
2). Select specific permissions, select R (clone)(i.e. Read permissions), click Add.
3). Created successfully.
4). In addition the same way to configure the user test2, the permissions are selected for the test.git to have RW (push) permissions, as well as the user test3, the permissions are selected for the test.git to have RWC (push, create ref) permissions.
Client Run
Install git locally, slightly.
$ git config--global user.name "Your name"
$ git config--global user.email "[Email protected]"
It should be noted that this does not need to be the same as the test user information set above, the name and the mailbox can use their own account
1). Use the administrator to create a new account test login
There is no content in the repository, although the admin has configured the test repository and given the test account clone permissions, but because the test warehouse is an empty warehouse, it is not shown here.
2). Exit test, log in using Test2
You can see the test repository, click to enter, like the admin account after creating the Repository page
Try to push with the prompt command.
The push failed because Test2 has only RW (push) permissions and does not have the permissions created. You can refer to the official documentation for specific permissions.
3). browser exit test2, login with Test3
Found not like Test2 login, there are prompts and commands, this is due to Test2 's submission, resulting in the version libraries into some file information data, about 620b, and the prompt information and command recommendations only in the empty version of the library will be displayed. We can continue the command line operation based on the Ssh://[email Protected]:29418/test.git provided on the page, as well as the operations that mimic test2.
Push successfully, browser refresh can be seen
3). The browser exits test3 and the same content can be seen using Test2 login. Next, test can download the repository content through a clone operation. Test2 can not only clone, can also push their own changes. Demo slightly.
other
- HTTPS security certificate access.
- SSH no password cloning push operation, the main operation is the client command line to create SSH key, through the following command:
$ ssh-keygen -t rsa -C "[email protected]"
, and then to the user's home directory to find the. SSH folder, the following generated the Id_rsa and id_rsa.pub two files, the content of the pub file copied, uploaded to the Gitblit site's own account, User Center->ssh, add success, Then the operation can be done through the SSH://protocol, without a password.
Windows platform uses gitblit to build a git server