A, gitlab Profile
GitLab is a warehouse management system for open source projects using Git as a code management tool, and build up on the basis of web services.
By Web access public or private project interface. It has the Github similar functions, you can browse the source code management deficiencies and comments. Management team can access to the repository, it is very easy to browse submitted version of the file and provides a historical repository. Team members can take advantage of built-in simple chat program (Wall) to communicate. It also provides a snippet collection functions can easily achieve code reuse. Gitlab private warehouse; GitHub public code repository.
Function: gitlab is to provide a code hosting, management platforms commit code review and issue tracking. Very important for the quality of software engineering management.
Version: gitlab into Community Edition ( CE ) and Enterprise Edition ( EE ).
Configuration: It is recommended CPU2 core, memory, 2G or more.
Gitlab service components:
1 ) Nginx : static web server.
2 ) gitlab the shell- : for processing Git command and modifications authorized keys list. ( Ruby )
3 ) gitlab-Workhorse: lightweight reverse proxy server. ( Go )
GitLab Workhorse is a quick reverse proxy. It will deal with a number of large HTTP requests, such as file upload, download files, Git the Push / pull and Git package download. Other requests to the reverse proxy GitLab Rails application, i.e., the reverse proxy to the backend Unicorn .
4 ) logrotate : log file management tools.
5 ) PostgreSQL : database.
6 ) Redis : cache database.
7 ) sidekiq : queue for execution tasks in the background (asynchronous execution). ( Ruby )
8 ) Unicorn : An HTTP Server for Rack Applications , gitlab Rails applications are hosted on this server above. ( Ruby Web Server , the main use Ruby to write)
Management command:
ctl-STOP gitlab # to stop all gitlab components
Start-ctl gitlab # start all gitlab components
ctl-restart gitlab # restart all gitlab components
Status-ctl gitlab # check the service status
gitlab-ctl reconfigure # recompile gitlab configuration (execute reconfigure command will gitlab of nginx configuration restore components, resulting in a modified custom domain name and port are all gone.)
vim /etc/gitlab/gitlab.rb # modify gitlab profile
gitlab-rake gitlab:check SANITIZE=true --trace #检查gitlab
ctl-tail gitlab # View Log
Two, gitlab installation and use
Step 1: Install gitlab
[root@ren5 ~]# yum localinstall gitlab-ce-8.9.5-ce.0.el7.x86_64.rpm -y
Step two: modify the configuration file
In the file 11 or so lines to modify the host name for the host IP address
[root@ren5 ~]# vim /etc/gitlab/gitlab.rb
########################################
11 external_url 'http://192.168.11.5'
#############################################
Comment lines # meanings:
1. do not take effect
2. defaults
The third step: Reconfigure (is the configuration to take effect, take some time)
Start gitlab when 80 port can not be occupied!
[ren5 the root @ ~] # gitlab the reconfigure-CTL # reconfigured
[root@ren5 ~]# ss -tnl
[root@ren5 ~]# lsof -i :80
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
nginx 9629 root 6u IPv4 50984 0t0 TCP *:http (LISTEN)
nginx 9630 gitlab-www 6u IPv4 50984 0t0 TCP *:http (LISTEN)
[root @ ren5 ~] # firewall -cmd --add-port = 80 / tcp # add firewall ports
[root@ren5 ~]# firewall-cmd --add-port=80/tcp --permanent
Step four: browser access
Directly enter the server IP to access
Need to enter a new password, the password required length . 8 bit ( Change your password )
The Admin into root , password is the password that were set, click on the sign in
Step five: gitlab use
In the windows can be created by the user, creating a project group, create a project to create a new project
In Linux in use
[root @ ren5 ~] # mkdir rrr # Create a root directory
[root@ren5 ~]# cd rrr
[root@ren5 rrr]# yum -y install git
[root @ ren5 rrr] # git clone http://192.168.11.5/root/first-project.git # clone a remote repository
[root@ren5 rrr]# ls
first-project
[root@ren5 rrr]# cd first-project/
[root@ren5 first-project]# ls -a
. .. .git
[root @ ren5 first-project] # touch {1..5} .txt # update file
[root@ren5 first-project]# echo "111111111111" > 1.txt
[root@ren5 first-project]# ls
1.txt 2.txt 3.txt 4.txt 5.txt
[root @ ren5 First-Project] # git the Add. # working directory content uploaded to the staging area
[root @ ren5 First-Project] # git the commit -m "v1" # to add content to the staging area warehouse
*** Please tell me who you are.
Run
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
to set your account's default identity.
Omit --global to set the identity only in this repository.
fatal: unable to auto-detect email address (got 'root@ren5.(none)')
[root@ren5 first-project]# git config --global user.email "[email protected]"
[root@ren5 first-project]# git config --global user.name "Your Name" #认证
[root @ ren5 First-Project] # git the commit -m "v1" # resubmit
[Master (filed root) d5aee1b] V1
5 files changed, 1 insertion(+)
create mode 100644 1.txt
create mode 100644 2.txt
create mode 100644 3.txt
create mode 100644 4.txt
create mode 100644 5.txt
[root @ ren5 First-Project] # git Branch # View branch
* master
[root @ ren5 First-Project] # git the Push -u Origin Master # the local push content to a remote repository
Username for 'http://192.168.11.5': root # Enter the user name
Password for 'http: //[email protected]': # password
[root @ ren5 first-project] # git branch hello # to create a new branch
[root @ ren5 first-project] # git checkout hello # switch to a new branch
Switching to the branch 'hello'
[root @ ren5 first-project] # touch test && echo "hello world"> test # add the test file
[root @ ren5 first-project] # git add. # add to the staging area
[root @ ren5 first-project] # git commit -m "v2" # Add to warehouse
[root @ ren5 first-project] # git push -u origin hello # push to a remote repository
Three, Linux which avoid the use of dense gitlab
In the above we each time you log gitlab have to enter the name and password of a lot of trouble, so you can use the key SSH to push.
Step 1: Generate Key
ssh-keygen
Step two: Copy the public key information
[root@ren5 first-project]# cat /root/.ssh/id_rsa.pub
Third step: pasting the web server profile-settings of ssh-keys in
Step four: After you click Submit information repository download again
After the carriage return can not see anything directly enter the download is complete
Note: The specified time is pulling ssh address is no longer http address!
Four, window in the free density used gitlab
The first step: preparation of documents
You need to first download the Internet following the client tools: Git-2.7.2-32-bit_setup.1457942412.exe
Step 2: Install
Step Three: Create a folder after a working directory to the directory; right-click the mouse has two options, one is bash one graphical
Fourth step: generating a secret key information , log-free adhesion; in this interface input ssh-keygen been generated secret key information points Enter
Step five: the public key information into the web server; you can see the information stored in the secret key from which the above information, and now we go to c disk find; copy the public key inside information
Step Six: Local download warehouse; use git clone plus your project ssh Information
Step Seven: Local View; warehouse information has been found, and now you can start to write a program
Step eight: Test; included into the .git directory, and right-click to open this bash, the process of creating a branch operation and establish test.txt test file
Step 9: Upload files; and linux in the same upload command execution
Step 10: In the web view in; you can see we have just the window created file has been uploaded onto the