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

GitLab: Web-based Git repository manager


# restart gitlab
gitlab-ctl restart

# git home directory

Reset admin password
gitlab-rails console production
u = User.where(id: 1).first
u.password = 'secret'
u.password_confirmation = 'secret'!

# full backup
gitlab-rake gitlab:backup:create

# backup without reposiories
sudo gitlab-rake gitlab:backup:create SKIP=repositories

# backup target


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 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

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

# checkout tag
git checkout 1.0.2

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

# rollback to revision
git checkout 96fe40ded8277725d244aac83c42256ad554cc3b .

# 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

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:agent ${USERS} | tar --extract --to-stdout
curl --silent --request GET --header 'PRIVATE-TOKEN: 1234567890' '' --output /tmp/file1.sql

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

Links - old GitLab packages archive

Syndicate content