GitLab
lastmod 2025-12-08created 2015-02-0589 edits
Version Control on your Server like GitHub but Open Source!!
Category
- gitlab.rb - Configuration file.
- Gitlab:Webhook
How to install
CentOS
Based on CentOS7, set it up as follows.
$ sudo yum install openssh-server
$ sudo systemctl enable sshd
$ sudo systemctl start sshd
$ sudo yum install postfix
$ sudo systemctl enable postfix
$ sudo systemctl start postfix
$ sudo firewall-cmd --permanent --add-service=http
$ sudo systemctl reload firewalld
Then download the Omnibus package.
$ curl -O https://downloads-packages.s3.amazonaws.com/centos-7.0.1406/gitlab-7.7.2_omnibus.5.4.2.ci-1.el7.x86_64.rpm
$ sudo rpm -i gitlab-7.7.2_omnibus.5.4.2.ci-1.el7.x86_64.rpm
Edit the configuration file if needed.
Start the service.
For reference, on CentOS the install location is /opt/gitlab/.
Ubuntu
$ sudo apt-get install curl openssh-server ca-certificates postfix
$ curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
$ sudo apt-get install gitlab-ce
$ sudo gitlab-ctl reconfigure
Configuration
Enable HTTPS
If you want to apply HTTPS with the default settings, just change the protocol of external_url to https as below.
If you want to specify the public key location, use the properties below.
# For GitLab
nginx['ssl_certificate'] = "/etc/gitlab/ssl/gitlab.example.crt"
nginx['ssl_certificate_key'] = "/etc/gitlab/ssl/gitlab.example.com.key"
Then place the public key certificate1 created for the domain name above as follows.
Create a new public key by referring to OpenSSL#How to create a certificate. Simply put, you can do it as follows.
$ sudo -s
$ cd /etc/gitlab/ssl
$ openssl req -x509 -sha256 -nodes -days 3650 -newkey rsa:2048 -keyout private.key -out certificate.crt
Gitlab in Docker
- Omnibus GitLab documentation > GitLab Docker images
- What Do You Need :: GitLab in Docker (easy installation)
- Installing GitLab with Docker
On initial installation, the administrator ID is root.
Testing the SMTP configuration
You can verify GitLab's ability to send emails properly using the Rails console. On the GitLab server, execute gitlab-rails console to enter the console. Then, you can enter the following command at the console prompt to cause GitLab to send a test email:
irb(main):003:0> Notify.test_email('[email protected]', 'Message Subject', 'Message Body').deliver_now
How to uninstall
You can remove it as follows.
# Stop gitlab and remove its supervision process
$ sudo gitlab-ctl uninstall
# Redhat/Centos
$ sudo rpm -e gitlab
# To remove all omnibus-gitlab data use
$ sudo gitlab-ctl cleanse
# To remove all users and groups created by omnibus-gitlab
$ sudo gitlab-ctl remove_users
How to update
- Updating GitLab via omnibus-gitlab
- Hreeman's Bravo Hree Life! - Upgrading GitLab
- Stove's Blog - Upgrading GitLab
## 실행중인 GitLab 서비스 중단.
$ sudo gitlab-ctl stop unicorn
$ sudo gitlab-ctl stop sidekiq
$ sudo gitlab-ctl stop nginx
## GitLab 백업하기.
sudo gitlab-rake gitlab:backup:create
## GitLab 업그레이드 하기.
sudo yum install gitlab-ce
## GitLab Repository 재설정 및 서버 재시작.
sudo gitlab-ctl reconfigure
sudo gitlab-ctl restart
How to backup
## GitLab 백업하기.
## - /etc/gitlab/gitlab.rb 에 gitlab_rails['backup_path'] 변수에 정의된 경로로 백업데이터가 저장된다.
## - 기본 백업 디렉토리는 /var/opt/gitlab/backups
$ sudo gitlab-rake gitlab:backup:create
(LEGACY!!) Restore as follows. <del>
$ sudo gitlab-ctl stop unicorn
$ sudo gitlab-ctl stop sidekiq
## Verify
$ sudo gitlab-ctl status
## Next, restore the backup, specifying the timestamp of the backup you wish to restore:
## This command will overwrite the contents of your GitLab database!
$ sudo gitlab-rake gitlab:backup:restore BACKUP=1393513186
## Restart!
$ sudo gitlab-ctl start
</del>
If you restore as below, the Timestamps in the backup directory are checked and the latest backup is used for the restore.
## Stop processes that are connected to the database
$ sudo service gitlab stop
## Restore
$ bundle exec rake gitlab:backup:restore RAILS_ENV=production
## Next, restore /home/git/gitlab/.secret if necessary as mentioned above.
## ...
## Restart GitLab:
$ sudo service gitlab restart
| WARNING |
| Note that backup and migration are different! If the version of the backed-up data differs from the current GitLab version, it cannot be restored properly. |
Restore for Docker image and gitlab-omnibus helm chart
For docker installations, the restore task can be run from host using the command
Creating a branch from issue in GitLab
If you create a branch named <issue-number>-issue-description and push it to gitlab, it is automatically linked to that Issue. For example, if there is an Issue with ID 654 and you create a branch named 654-some-feature and push it to gitlab, it is linked to Issue 654.
Gitlab asks whether you want to create a merge request, and automatically adds Closes #654 to the merge request description, which closes issue 654 when the merge request is accepted.
Also, when you go to a specific issue page in gitlab, you should see a New Branch button that automatically creates a branch named in the <issue-number>-issue-description format.
From the GitLab documentation
Prefix a branch name with an issue number to streamline merge request creation. When you create a merge request for a branch with a name beginning with an issue number, GitLab:
- Marks the issue as related. If your project is configured with a default closing pattern, merging this merge request also closes the related issue.
- Copies label and milestone metadata from the issue.
Time tracking
You can use Quick Actions in the issue description and comment boxes.
-
/estimate- Updates the estimated time. -
/spend- Updates the total time actually spent.
Auto DevOps
Auto DevOps detects the programming language and uses CI/CD templates to create and run default pipelines that build and test the application.
You can then configure deployments to deploy the app to staging and production, and set up Review Apps to preview changes per branch.
How to disable
To enable (or disable) Auto DevOps for all projects:
- On the left sidebar, at the bottom, select Admin.
- Select Settings > CI/CD.
- Check (or uncheck to disable) the box that says Default to Auto DevOps pipeline for all projects.
- Optionally, set up the Auto DevOps base domain which is used for Auto Deploy and Auto Review Apps.
- Select Save changes for the changes to take effect.
Example
-
sudo gitlab-ctl status - Check the current status of GitLab.
-
sudo gitlab-rake gitlab:env:info - Check GitLab's version information.
GitLab Systems Diagram
All the Tech Stack Applications GitLab uses internally. A good reference for what solutions a fully remote company uses. A separate Google Sheet summarizes at a glance the product (link), purpose of use, access permissions, group/business/technical owner, what data it collects, whether it is customer-facing or employee-facing, and so on
- Finance : Stripe, NetApp, Zuora, ADP, Blackline, Expensify, Clari, Carta, Xactly, Avalara, "CloudExtend: Gdrive for NetSuite", NetSuite
- Sales : Salesforce, Chrous.ai, Clari, OwnBackup, Sertifi
- PeopleOps : Zoom, Gmail, Calendly, Beamy, Lumity, Beeterment, Teleport, Moo, Bonusly, Slack, NexTravel, Crowdin, Will Interactive, CultureAmp, Greenhouse
- Data Team : Data warehouse, Periscope
- Product : GitLab, dev.gitlab, customers.gitlab, license.gitlab, version.gitlab
- Legal : ContractWorks, Conga Contracts, Visual Compliance
- Advertising/Social : PMG, Facebook Advertising, Linked Advertising, Google AdWords, Sprout Social, Tweetdeck, EventBrite, Youtube, Moz Pro
- Marketing : MailChimp, mailgun, Mandrill, Meetup, Disqus, Google Analytics, Google Tag Manager, Cookiebot, shopify, about.gitlab, Zapier, Marketo, Demandbase, Drift, PathFactory, Bizzabo, FunnelCake, Bizible, Enrichment TBD, LeanData, WebEx, Outreach, Point of Reference
- Prospecting & Enrichment : DiscoverOrg, DataFox, LinkedIn Sales Nav, GovWin(PubSec), Lusha (EMEA)
- Meeting Setting Vendors : Dogood, BAO (By Appointment Only)
Troubleshooting
502 error
This may be caused by Unicorn, which acts as the gateway, not working properly. If you check the log file, you can see an error message like the one below. For reference, the log file is at ./var/log/gitlab/nginx/gitlab_error.log.
2015/04/08 18:55:26 [error] 32263#0:
*1 connect() to unix:/var/opt/gitlab/gitlab-rails/sockets/gitlab.socket failed
(111: Connection refused) while connecting to upstream,
client: [CLIENT_IPADDRESS],
server: [HOSTNAME], request: "GET / HTTP/1.1",
upstream: "http://unix:/var/opt/gitlab/gitlab-rails/sockets/gitlab.socket:/", host: [HOSTNAME]
Note that on a single-core server it may take up to a minute to restart Unicorn and Sidekiq. Your GitLab instance will give a 502 error until Unicorn is up again. It is also possible to start, stop or restart individual components.
Unicorn supports zero-downtime reloads. These can be triggered as follows:
Note that you cannot use a Unicorn reload to update the Ruby runtime.
Or check the posts below:
- "502 bad gateway" Gitlab error in nginx server
- connect() failed (111: Connection refused) while connecting to upstream
- 502 error caused by connection refused: (upstream fastcgi, etc) (23 posts)
413 Request Entity Too Large
The following error may occur on git push.
$ git push gitlab
Counting objects: 8549, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (6388/6388), done.
error: RPC failed; HTTP 413 curl 22 The requested URL returned error: 413 Request Entity Too Large
fatal: The remote end hung up unexpectedly
Writing objects: 100% (8549/8549), 69.59 MiB | 136.81 MiB/s, done.
Total 8549 (delta 1833), reused 8549 (delta 1833)
fatal: The remote end hung up unexpectedly
Everything up-to-date
Edit the /etc/gitlab/gitlab.rb file as below.
If a Proxy server sits at the Front-end, you also need to change the maximum client Body size on that server.
SSL Verification error
Just add the certificate to the /opt/gitlab/embedded/ssl/certs/cacert.pem file.
HTTP 413 curl 22 The requested URL returned error
- RPC failed; HTTP 413 curl 22 The requested URL returned error: 413 Request Entity Too Large
- Account and limit settings | GitLab # 413 Request Entity Too Large
- (gitlab) Solving the Error 413
- Fixing the nginx upload file size exceeded error - HTTP 413 client intended to send too large body
If you use a Reverseproxy, you must also change that that server.
gitlab.rb before increasing the max attachment size:
Or limit the POST buffer size the client can upload.
For reference, if you use nginx as a reverse proxy, you need to change the following value.
Server responded with 0 code
- Wiki : attach a file not working (#52243) · Issues · GitLab.org / GitLab FOSS · GitLab
- NGINX settings | GitLab
- Mixed content - Web security | MDN
The error above can occur when uploading a file in gitlab-wiki. If checking the server logs or network status shows that no particular request was made, check the browser console. There is a good chance the following error was printed.
<span style="color: red">Blocked loading mixed active content “http://git.your.com/api/v4/projects/51/wikis/attachments”
You can check the warning above in detail on the MDN site. If you look closely, you can see a call to http from an https site.
Changing http to https in the external_url value of the configuration file will do.
However, if you configured external access as https and the inside as http with a proxy such as traefik, set it as follows.
# external_url 'GENERATED_EXTERNAL_URL'
external_url 'https://your_externarl_url'
nginx['listen_port'] = 80
nginx['listen_https'] = false
nginx['proxy_set_headers'] = {
"X-Forwarded-Proto" => "https",
"X-Forwarded-Ssl" => "on"
}
For reference, for me it worked fine even without setting the nginx['proxy_set_headers'] part.
After finishing the configuration, restart the container or use the following command.
List of Issue Tracking System
- Issue Tracking System
- Mantis
- Bugzilla
- Blossom
- Request Tracker
- The Bug Genie
- WebIssues
- ChiliProject
- Jira
- TRAC
- Redmine
- GitHub
- GitLab
- Yona
- git-bug - A bug tracker stored in a git repo
- Kitemaker - A JIRA-alternative collaboration tool for remote teams
- Plane - Open-source alternative to JIRA/Linear
- Linear
See also
Favorite site
- gitlab web site
- Download GitLab Community Edition (CE)
- Installing GitLabHQ on Ubuntu 2
- Assistant Manager Kim installs Gitlab 5.1 3
- Installing gitlab on RHEL/CentOS 6
- Installing the GitLab rpm on CentOS 6.5
- Installing GITLAB on CENTOS6 | CENTOS6にGITLABインストール
- How to back up gitlab data and attachments
- Installing GitLabHQ on Ubuntu
Documentation
Install
CI
Articles
- How GitLab cut repository backup time from 48 hours to 41 minutes | GeekNews
- [Original] How we decreased GitLab repo backup times from 48 hours to 41 minutes
- The root cause was the O(N²) complexity of a 15-year-old Git function, and performance was greatly improved through algorithm optimization
- As a result of the optimization, backup time for the largest repository dropped from 48 hours to 41 minutes
- Starting with GitLab 18.0, all users get these benefits without any extra configuration
References
- Cloud Computing
- Container Registry
- Continuous Integration
- ContinuousIntegration:ImplementationGuide
- DevOps:Kubernetes
- Filestash
- Git
- Git Large File Storage
- Git-bug
- Git:Push
- Git:Revert
- Git:Troubleshooting:Push
- Gitea
- GitHub
- Github:Webhook
- GitLab CI
- Gitlab.rb
- GitLab:Kubernetes
- GitLab:PackageRegistry
- GitLab:Runner
- GitLab:Upgrade
- Gitlab:Webhook
- Gitlab:Webhook:Example
- GitLabCI:Artifacts
- GitLabCI:Npm
- GitLabCI:Python
- GitLabCI:Yarn
- Gitolite
- Gogs
- Issue Tracking System
- Jira
- Kallithea
- Kitemaker
- Kubeflow:Install
- Linear
- Mylyn
- Next.js
- Nginx:HttpsProxyFrontEnd
- Nginx:ReverseProxy
- Plane
- Project Management
- Redmine
- Shields.io
- TRAC
- Version Badge
- Yona