GitLab FAQ
Installation Issues
What to Do If GitLab Installation Fails?
Installation failure is usually caused by a few common reasons. First, check if the system meets the minimum requirements, including operating system version, memory, and disk space. If installation using the self-hosted script fails, try manually installing dependency packages and then installing step by step.
View installation logs to get detailed error information:
# Ubuntu/Debian
sudo apt-get install -y gitlab-ce 2>&1 | tee /tmp/gitlab-install.log
# View logs
sudo tail -f /var/log/gitlab/install.log
Common errors include: port conflicts (ports 80, 443, 22 are occupied), insufficient memory, SSL certificate issues, etc. If there's a port conflict, either stop the service occupying the port or modify GitLab configuration to use other ports.
How to Modify GitLab Access Address?
If you need to modify GitLab's access address after installation, edit the external_url parameter in /etc/gitlab/gitlab.rb, then reconfigure:
sudo nano /etc/gitlab/gitlab.rb
# Modify external_url
sudo gitlab-ctl reconfigure
After modification, ensure DNS resolution or local hosts file is correctly configured so the new address can be accessed normally. If changing from HTTP to HTTPS, you also need to configure SSL certificates.
Usage Issues
What to Do If SSH Key Connection Fails?
SSH key connection failure can be caused by multiple reasons. First, confirm the public key has been correctly added to the GitLab account's SSH keys:
# View local public key
cat ~/.ssh/id_ed25519.pub
# Test connection
ssh -T [email protected]
If the test connection fails, check SSH client configuration:
# Edit SSH config
nano ~/.ssh/config
# Add the following
Host gitlab.example.com
HostName gitlab.example.com
User git
IdentityFile ~/.ssh/id_ed25519
IdentitiesOnly yes
Ensure the remote repository URL uses SSH format ([email protected]:group/project.git), not HTTPS format.
What to Do If Merge Request Cannot Be Merged?
Merge requests may be unable to merge due to the following reasons: conflicts exist, CI/CD tests failed, protected branch rules not met, missing approvals, etc. The solution is to troubleshoot one by one:
- Merge conflicts: Click "Update Branch" on the merge request page, merge the target branch into the source branch, resolve conflicts, then push again
- CI failure: View the failed job log, fix the problem, then rerun the pipeline
- Branch protection: Contact project administrator to modify protected branch settings, or have a member with permissions merge
How to Troubleshoot CI/CD Pipeline Run Failures?
When a pipeline fails, first view the log of the failed job on the CI/CD → Pipelines page. The log will show specific error information and failure reasons. Common problems include: dependency download failure, script command errors, test case failures, etc.
If the problem is difficult to locate, you can add debugging steps in the pipeline configuration, such as outputting environment variables, checking file status before and after installation, etc. You can also use interactive debugging to start an interactive shell in pipeline jobs for troubleshooting.
Performance Issues
GitLab Access Is Very Slow, What to Do?
Slow access can be caused by insufficient server resources, network latency, or improper configuration. First check server load:
sudo gitlab-ctl status
top -bn1 | head -20
If CPU or memory usage is very high, you may need to upgrade server configuration or optimize GitLab settings. You can also check database performance:
sudo gitlab-rake gitlab:git:fsck # Check Git repository integrity
sudo gitlab-rake db:index_cache_daily # Optimize database cache
For network issues, consider using CDN to accelerate static resource delivery, or deploy GitLab at network locations closer to users.
How to Optimize GitLab Performance?
Optimizing GitLab performance can be approached from multiple aspects. Database optimization is important. Regular maintenance can significantly improve performance:
# Clean database
sudo gitlab-rake gitlab:db:analyze
sudo gitlab-rake gitlab:db:optimize
# Clean unused files
sudo gitlab-rake gitlab:cleanup:builds
For large repositories, you can enable Git object pools to reduce disk usage, or configure Git LFS to store large files. Reasonably setting CI/CD caching can speed up builds.
Security Issues
How to Configure SSL Certificates?
GitLab supports automatic SSL configuration with Let's Encrypt, or you can use custom certificates. First edit the configuration file:
# Let's Encrypt auto-configuration
letsencrypt['enable'] = true
external_url 'https://gitlab.example.com'
# Custom certificate
nginx['ssl_certificate'] = "/etc/gitlab/ssl/server.crt"
nginx['ssl_certificate_key'] = "/etc/gitlab/ssl/server.key"
Run sudo gitlab-ctl reconfigure to apply the configuration. If using self-signed certificates, clients need to trust the certificate to access via HTTPS.
How to Back Up and Restore GitLab?
Regular backups are important to prevent data loss. GitLab provides a built-in backup tool:
# Create backup
sudo gitlab-backup create
# Backup file location
ls -la /var/opt/gitlab/backups/
Backup files include databases, uploaded files, and Git repositories. To restore: stop GitLab service, copy backup file to default location, then run restore command:
sudo gitlab-ctl stop
sudo gitlab-backup restore BACKUP=timestamp
sudo gitlab-ctl reconfigure
sudo gitlab-ctl start
It is recommended to automatically sync backup files to remote storage, such as object storage services or another server.
Upgrade Issues
What to Do If Errors Appear After Upgrading?
After upgrading, compatibility errors or functional abnormalities may occur. First check GitLab status:
sudo gitlab-ctl status
sudo gitlab-rake gitlab:check
View upgrade logs to understand specific errors:
sudo tail -100 /var/log/gitlab/gitlab-rails/production.log
Common problems include: database migration failure, configuration file syntax errors, missing dependencies, etc. If it's a database migration problem, you may need to manually fix:
sudo gitlab-rake db:migrate
It is recommended to back up data before upgrading, and carefully read the official upgrade documentation to understand major changes between versions.
How to Safely Upgrade Between Different Versions?
Upgrading GitLab should follow version jump limits, jumping no more than one major version at a time. For example, upgrade from 15.x to 16.x, not directly from 15.x to 17.x. First upgrade to the intermediate version, confirm normal operation, then continue upgrading.
Perform the following steps before upgrading: back up data, check compatibility issues, read release notes. Keep power and network stable during the upgrade process, and verify all functions are normal after upgrading.
