Building and using Git server Gitlab

Source: Internet
Author: User

Git servers are famous for gitosis and Gitolite, which are two manageable and slightly more complex to use, with no web pages, and Gitlab is a github-like tool that GitHub can't build for free, and for code security, So in the intranet installed a own laboratory of a GIT server, multi-party comparison, select Gitlab,gitlab has a lot of dependencies, and Bitnami made a one-click installation of the package, download link: https://bitnami.com/redirect/to/ 37478/bitnami-gitlab-7.0.0-0-linux-installer.run, making the installation so simple.


1. During the installation process, an administrator account will be set up, which can be used to log in, and the members of the Gitlab cannot apply freely and require an invitation from the Administrator;

2. Set up SSH, see Help:


(1) See if you have previously generated SSH keys:

[Plain]View Plain copy
    1. Cat ~/.ssh/id_rsa.pub
If a section of Ssh-rsa begins, indicating that it has been generated, you can skip this step;

(2) If the SSH key was not previously generated, use the command:

[Plain]View Plain copy
    1. Ssh-keygen-t rsa-c "[Email protected]"
To generate the key. The resulting file, Id_rsa, is the private key on its own computer, and id_rsa.pub is the public key that is placed on the server for authentication.

(3) Put SSH's public key on Gitlab, the page is as follows:


Click Add SSH key;

3. Workflow, or look at Gitlab's help documentation, as follows:


Translate a bit ...

(1) Cloning administrator to build a good project:

[Plain]View Plain copy
    1. git clone [email protected]:p Roject-name.git

(2) Create your own local branch (the name of the branch uses a small hump-like nomenclature, use your own name + functions, such as Zyhighway, do not use special characters):

[Plain]View Plain copy
    1. git checkout-b $feature _name
(3) write the code and submit the written code to the local branch: [Plain]View Plain copy
    1. Git commit-am "My feature is ready"
(4) Push the branch to the Gitlab server: [Plain]View Plain copy
    1. Git push Origin $feature _name
(5) On the submission page of Gitlab, review the code submitted by yourself;

(6) Submit a merger request;

(7) The administrator reviews the code and decides whether to merge the code onto the main branch.


4. Branching models


In the master branch, the code that is stable enough, that is, the code that has been published or is about to be released, the develop branch, which is used for subsequent development, is merged into the master branch once the stability test is passed, and the module branches are generated on the basis of the develop branch, and after the module functions are implemented, Merge to the develop branch, and then merge into the master branch after the test is stable.


5. Scenario Simulation

(1) Administrator Zhaoyu, create a new project vanet, and invite Huqiong to join, the role for developers:


(2) The member Zhaoyu clones the project, writes a code, and uploads the written code to the server's Zhaoyuhighway branch:


To submit the page, find that a new branch has been established, and you can submit a merge request to the Administrator, and the administrator-associated mailbox will be subject to the corresponding message:


Browse through the submitted code:



We are here now and will continue to update later.


Report:

1. How the server shuts down and starts the Gitlab server and sets the boot entry to boot:

There is a file in the installed directory: ctlscript.sh, through./ctlscript.sh start can be started, specifically in the Readme file.

Change file permissions: Chown git:git ctlscript.sh

Add the corresponding command to the startup file:/etc/rc.local:./opt/gitlab-7.0.0-0/ctlscript.sh start

2. Modify [domain_name in email protected]_name

In the installation, you need to set domain_name, I set up here to my public network IP, if not set up, you can refer to the post: Click the open link, modify the file:

[Plain]View Plain copy
    1. /home/git/gitlab/apps/gitlab/htdocs/config/gitlab.yml
Change the host in two places into an extranet IP.

3. Thinkserver Installing the Red Hat system

The Thinkserver RD340 is used to build the server, and the supported operating systems are Red hat. Installation system first with the CD-ROM boot/partition, and then installed with the system CD, after installation, restart will appear the cursor, note that there is still a need to insert the installation CD, the installation is not completed at this time.

After installing the system on Red Hat, Gitlab's access speed is very slow, later found that the problem of the network card, the network cable to plug and unplug the good.

Time zone settings, in the location of the column has not been able to find Asia/Shanghai, the geographical location to delete, set the time, so that some time on the Web page will not be wrong.

4. Data migration (7.1gitlab migration of Ubuntu to Redhat 7.8)

Pending write

5. About 7.8.1 's free registration

Configure the mailbox, you can automatically register, but it is not easy for the team's confidential work, or to use the invitation to register.

6. Upload the original repository's code to the new server, including the log of the commit record:

[Plain]View Plain copy
  1. [Email protected]:~/longmenshan/longmenshan$ git push-u Origin Master
  2. @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  3. @ warning:remote HOST Identification has changed! @
  4. @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  5. IT is POSSIBLE this SOMEONE is DOING SOMETHING nasty!
  6. Someone could is eavesdropping on your right now (Man-in-the-middle attack)!
  7. It is also possible, a host key has just been changed.
  8. The fingerprint for the RSA key sent by the remote host is
  9. F9:46:83:46:cd:62:60:56:bb:df:19:c0:47:8d:b0:be.
  10. Please contact your system administrator.
  11. Add correct host key in/home/zy/.ssh/known_hosts to get rid of the this message.
  12. Offending ECDSA Key In/home/zy/.ssh/known_hosts:2
  13. Remove With:ssh-keygen-f "/home/zy/.ssh/known_hosts"-R 222.197.180.140
  14. RSA host key for 222.197.180.140 had changed and you have requested strict checking.
  15. Host Key verification failed.
  16. Fatal:could not read from remote repository.
Reference post: Click the Open link to delete the records from the previous known_hosts.


Reference:

1. Gitlab work together: http://herry2013git.blog.163.com/blog/static/219568011201341111240751, the original author also produced a video tutorial, is a good reference;

2. "Pro git Chinese version", familiar with git common operation and basic principles;

3. Git's definitive guide to learn more about Git

Building and using Git server Gitlab

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.