Windows platform uses gitblit to build a git server

Source: Internet
Author: User

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
    • Refer to the official documentation. Modify the gitblit.properties under the data file in the Gitblit installation directory.

      1. include = defaults.propertiesIt is commented out and added include = my.properties .
      2. From the Data folder found the Defaults.properties file, which is the default configuration of Gitblit, copy the file again, and renamed the appeal modified configuration name, I here is my.properties.

      3. Open My.properties, mainly modify the following points:
        3.1. Git.repositoriesfolder (repository path): Change this to your new repository directory path (note that you want to use a backslash in the path), and do not change the default to the Git directory in the Gitblit directory.

        3.2. Server.httpport: Sets the port number of the HTTP protocol. The default of 0 means that the HTTP protocol is disabled.


        3.3. Server.httpbindinterface: Sets the IP address of the server. There is no content by default, the server can be accessed locally via localhost, and if specified, it can only be accessed by the specified IP address.
Run
  • First visit
    1. Run the Gitblit.cmd batch file under the Gitblit root directory.

    2. Browser access.

    3. Enter the Administrator account admin/admin login.

    4. You can modify the login password and suggest changes.

  • To create a version library
    1. Create a repository, click the Create Repository in the drop-down menu, or manage it from the repository on the page.

    2. Enter a name, the specific access policy and the initialization content default, according to the actual needs change.

    3. 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.

    4. 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
    1. Click users in the drop-down menu.

    2. Click Add Users in the top right corner, go to the Details page, fill in the general information.

    3. The property page is filled in and optional, depending on the situation.

    4. 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

Install git locally, slightly.

    • Configuration

$ 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

    • Visit site

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
    1. HTTPS security certificate access.
    2. 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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.