The thought of Gitlab is bound to think of SVN, because both are code management systems, as developers, using the SVN graphical interface and SVN code update and submission methods,
You might find it troublesome to use git, but git is very handy and has a lot of benefits, and git will be a fad and a trend behind it. So here's a brief introduction to Gitlab.
Server building and some basic git operations to use.
Advantages and disadvantages of git introduction
1, suitable for distributed development, emphasizing individual
2, public server pressure and data volume are not too large
3, fast, flexible
4, any two developers can easily resolve the conflict
5, offline can be normal to submit code and work
Disadvantages
1, the learning cycle is relatively long
2, do not conform to conventional thinking
3, code confidentiality is poor, once the developer has cloned the entire library can fully disclose all code and version information
Prepare the Environment
Ubuntu16.04 Server
Installation Introduction
The main records in the Ubuntu 16.04 operating system to build Gitlab server operations record, the following are the steps (main reference: https://about.gitlab.com/downloads/#ubuntu1604)
Gitlab installation 1. Install dependent packages
sudo apt-get install curl openssh-server ca-certificates postfix
Note: After execution completes, the mail configuration appears, select the Internet item (without smarthost)
2. Using the image of Tsinghua University (https://mirror.tuna.tsinghua.edu.cn/help/gitlab-ce/) to install the main program First Trust Gitlab's GPG public key
Curl https://packages.gitlab.com/gpg.key 2>/dev/null | sudo apt-key add-&>/dev/null
To modify a configuration file using the root user
Vi/etc/apt/sources.list.d/gitlab-ce.list
#添加以下内容
Deb https://mirrorsTunaTsinghuaedu. Cn/gitlab-ce/ubuntu xenial main
Vi/etc/gitlab/gitlab.rb
External_url ' http://172.16.81.91/'
Installing Gitlab-ce
sudo apt-get update
sudo apt-get install gitlab-ce
3. Start sshd and Postfix services
Service sshd start
Service Postfix Start
4. Adding firewall rules
sudo iptables -A INPUT- p tcp- m TCP --dport -j ACCEPT
5. Start the Services
sudo gitlab-ctl reconfigure
6. Check that the Gitlab is installed and running correctly
sudo gitlab-ctl status
#如果得到类似下面的结果, it means that Gitlab is working properly
7. Browse the Web page and set the password
http://172.16.81.91/
8. Create a group
9. Add SSH Key
The code Transfer protocol between GIT repositories mainly uses the SSH protocol. While the general build Gitlab use git user is no password, so direct ssh is not able to log in, you need to use Ssh-keygen upload public key, using asymmetric encryption transmission. Here's how to upload your SSH public key:
Generate Sshkey
Tapping the following command in the terminal, the first step generates a pair of private keys and a public key, respectively, present ~/.ssh/id_rsa
and ~/.ssh/id_rsa.pub
medium. The second step looks at the public key string.
ssh-keygen -t rsa -C "邮箱地址" cat ~/.ssh/id_rsa.pub
On the panel, click Profile settings–> ssh keys–> Add ssh Keys. Then copy the content from the previous step and id_rsa.pub
paste it into the input box and save it.
After completing the above two steps, the successful addition of the Sshkey, and then you can upload the code.
10. Create a project
Create a project Test_project
Next, select the group, enter the project name
Next, create the complete
Below the project there will be git's operating instructions to teach you how to operate
Finish creating the Project!
At this point, the Gitlab server building based on Ubuntu 16.04 x64 OS is complete! Continue to share Git's basic use later!
Ubuntu Build Gitlab server