warning: Creating default object from empty value in /data/web/1/000/027/003/273448/htdocs/ on line 33.

GitLab runner

wget -O - | apt-key add -
cat < /etc/apt/sources.list.d/gitlab-runner.list
deb xenial main
apt update
apt install gitlab-runner

Instlal with Ansible

Get token from GitLab server

# configure DNS for GitLab server

GitLab: Web-based Git repository manager


# restart gitlab
gitlab-ctl restart

# git home directory

Reset admin password
# change root password
sudo gitlab-rails console
user = User.where(id: 1).first
user.password = user.password_confirmation ='xxx'!

Gitlab settings API
curl --header "PRIVATE-TOKEN: 11112222333344445555"

Disalbe register / Singup


git hooks post-merge example


# check for modified files
for FILE in $(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD); do
  case "${FILE}" in
      # Repository configuration changed: update configuration
      # Crontab changed: update user cronjobs

# show repository info
git describe
git config -l

# show diff for one file
git diff

# commit only one file
git commit -m 'my comment' path/to/file

# create Git repository
git init

# add all files
git add .

# commit
git commit -m "initial project version"

# list tag
git tag -l

# checkout over SSH
git clone

# pull single file
git checkout filename

# pull single file from remote
git checkout origin/master -- path/to/file

# sync changes from other branch
git rebase master
git rebase brach1

# checkout to checkout to specific folder
git clone /path/to/folder

# create tag
git tag -a v1.4 -m 'version 1.4'
git push --tags
git push origin

# remove tag
git tag -d tag123
git push origin :refs/tags/tag123

# checkout tag
git clone --branch bar-1.0.4 /tmp/bar-1.0.4

# git pull single file
git checkout origin/master -- file_name

# reset branch
git reset --hard origin/master
git reset --hard origin/branch123

# rollback to revision
git checkout 96fe40ded8277725d244aac83c42256ad554cc3b .

# create branch
git checkout -b branch_name

# switch branch
git checkout branch_name
git checkout master

# checkout branch
git clone --branch --single-branch []

# test
git reset file/to/overwrite

# search for string
git grep "string/regexp" $(git rev-list --all)

# grep
git grep foo HEAD

# remove last commit
git reset HEAD~1

# reset to latest revision
git reset --hard

# reset to commit-id
git reset --hard
git push origin HEAD --force

git cherry-pick commit1

# diff between branches
git diff master

# show branches
git branch

# push local Git branch to remote master branch
git push origin local_branch_1:master

# delete local branch
git branch -d local_branch_name

# delete remote branch
git push origin :remote_branch_name

# ignore

# git global setup
git config --global "first_name last_name"
git config --global ""
git config --global core.autocrlf true

# create a new repository
git clone
cd repository_name
git add
git commit -m "add README"
git push -u origin master

# Add existing folder or Git repository
cd existing_folder
git init
git remote add origin
git add .
git commit
git push -u origin master

# search for string in commit
git grep foo $(git rev-list --all)

# check out single file
git archive HEAD:path1/file_or_dir target_file_name | tar --extract

# set proxy
git config --global http.proxy $http_proxy
git config --global https.proxy $https_proxy

# undo changes on file
git checkout -- file

# inclue a commit
git cherry-pick commit1


Install GitLab

wget -q --no-check-certificate -O - | bash -


# ensure that this script is run by root
if [ $(id -u) -ne 0 ]; then
    sudo $0

# install required packages
apt-get install -y ca-certificates curl cron

#  bypass the apt-cacher-ng proxy
echo ' "DIRECT";' > /etc/apt/apt.conf.d/99_gitlab

# download GitLab installation script
curl -s | bash

# workaround for PostgreSQL shmmax issue
echo "kernel.shmmax=17179869184" >> /etc/sysctl.d/90-shmmax.conf
/sbin/sysctl -p /etc/sysctl.d/90-shmmax.conf

# install GitLab Community Edition
apt-get install -y gitlab-ce

# configure domain
sed -i "s||$(hostname -A | tr -d ' ')|g" /etc/gitlab/gitlab.rb
gitlab-ctl reconfigure


user: root
pass: 5iveL!fe

Downloads: GitLab CE Download Archives

# check instalation
gitlab-rake gitlab:check

# GitLab APT repository

# rebuild an authorized_keys file
gitlab-rake gitlab:shell:setup

# install specific version
sudo apt-get install -y gitlab-ce=7.10.1~omnibus.1-1

Send email notification
Notify.test_email('', 'GitLab test subject', 'GitLab test message').deliver_now

Links - old GitLab packages archive

Syndicate content