gitlab server deployment

1. Introduction
GitLab is an open source project for warehouse management system. It uses Git as a code management tool and builds a web service on this basis.
GitLab has similar functions to Github, it is very easy to browse submitted versions and provides a file history library.
2. Installation
1. Obtain the installation package
wget https://packages.gitlab.com/gitlab/gitlab-ce/packages/ol/7/gitlab-ce-11.9.6-ce.0.el7.x86_64.rpm
2. Install dependency package
yum install curl policycoreutils openssh-server openssh-clients postfix
3. Install gitlab
yum localinstall gitlab-ce-11.9.6-ce.0.el7.x86_64.rpm
4. Configure gitlab
vim /etc/gitlab/gitlab.rb

#gitlab绑定本地IP地址或域名
external_url 'http://10.0.0.101'
#gitlab数据目录
git_data_dirs({ "default" => { "path" => "/data/gitlab-core" } })
#邮箱设置
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.exmail.qq.com"
gitlab_rails['smtp_port'] = 465
gitlab_rails['smtp_user_name'] = "[email protected]"
gitlab_rails['smtp_password'] = "123456"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_tls'] = true
gitlab_rails['gitlab_email_from'] = '[email protected]'

5. Start the service
# reload the configuration file
gitlab-ctl reconfigure
# start gitlab
gitlab-ctl start
6. Verify the mail
gitlab-rails console
Notify.test_email('recipient's mailbox','mail title','mail body'). deliver_now
7. Verify
Web: Access: 10.0.0.101
User: root
Password: rootpasswd
gitlab server deployment
3. Turn off automatic registration
# We turn off automatic registration, because our internal use does not require users to register themselves. Users can be assigned by operation and maintenance.
gitlab server deployment
4. Add keys. Do secret-free verification
1. Create the key
ssh-keygen -t rsa on the client side
2. Copy the public key
cat ~/.ssh/id_rsa.pub
3. Add the public key on gitlab.
gitlab server deployment
gitlab server deployment
Note: You can pull code
five after saving , Backup and restore
1. Backup, default path: /var/opt/gitlab/backups
gitlab-rake gitlab:backup:create
2. Restore
gitlab-rake gitlab:backup:restore BACKUP=1610557313_2021_01_14_11.9.6
VI. Common commands #Create
git warehouse
git init
#Pull the code on gitlab
git clone git@linux-gitlab:web/web-demo.git #identity
authentication
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
#Add the file to the warehouse for subsequent submissions
git add file.txt #Submit
the file to the warehouse
git commit -m "readme" #View
status
git status #View
the difference between the latest version in the workspace and the repository
git diff HEAD - readme.txt #Undo
all the modifications of the file in the work area
git checkout - file
#Undo the modifications in the temporary storage area and put it back in the work area
git reset HEAD <file> #Display
from the most recent to the most recent Far commit log
git log
git log --pretty=oneline #Return
to the previous version (HEAD means the current version, HEAD^ means the previous version, HEAD^^ means the previous version, and the upper 100 can be written as HEAD~100)
git reset --hard HEAD^ #Return
to the version before the return (all version IDs must be backed up before returning, otherwise you cannot go back to the future)
git reset --hard 1094a #Delete
the file from the repository
git rm file #Associate the
remote library
git remote add origin git@linux-gitlab:web/web-demo.git #Push
all the contents of the local library to the remote library
git push -u origin master #Pull
and integrate code from a warehouse or local branch
git pull #Create
a dev branch and switch
git checkout -b dev
or
git branch dev
git checkout dev
or
git switch -c dev # means to create and switch Branch
git switch master # means to switch directly to the existing master branch
# View the current branch
git branch
# Merge the dev branch to the current branch
git merge dev
# Add the --no-ff parameter to merge in normal mode, the history after the merge There are branches
git merge --no-ff -m "merge with no-ff" dev #Delete the
specified branch
git branch -d dev
# "Store" the current work site
git stash #View the
"Store" work site
git stash list #Restore the
"Storage" work site
git stash apply #After the restoration, the stash content is not deleted, use git stash drop to delete
git stash pop #Restore and delete the stash content at the same time #copy
a specific submission to the current Branch
git cherry-pick 54c805e2 #View
the information of the remote library
git remote -v #Play
a new tag
git tag v1.0 #View
all tags
git tag #Tag
the specified submission
git tag v0.9 <commit id> #View the
specified Tag
git show v0.9 #You
can specify tag information
git tag -a <tagname> -m "comment" #Delete
tag
git tag -d v0.1 #Push
a tag to remote
git push origin v1.0
#次性All local tags that have not yet been pushed to the remote
git push origin --tags #Remote
delete, first delete from the local
git tag -d v0.9
git push origin :refs/tags/v0.9

Guess you like

Origin blog.51cto.com/7965676/2590817