Help us learn about your current experience with the documentation. Take the survey.
更改您的时区
- 版本:Free, Premium, Ultimate
- 产品:GitLab Self-Managed
用户可以在其个人资料中设置时区。 新用户没有默认时区,必须在个人资料中明确设置后才会显示。 在 GitLab.com 上,默认时区为 UTC。
GitLab 中的默认时区是 UTC,但您可以将其更改为您喜欢的时区。
要更新您的 GitLab 实例的时区:
-
指定的时区必须为 tz 格式。 您可以使用
timedatectl命令查看可用的时区:timedatectl list-timezones -
更改时区,例如更改为
America/New_York。
-
编辑
/etc/gitlab/gitlab.rb:gitlab_rails['time_zone'] = 'America/New_York' -
保存文件,然后重新配置并重启 GitLab:
sudo gitlab-ctl reconfigure sudo gitlab-ctl restart
-
导出 Helm 值:
helm get values gitlab > gitlab_values.yaml -
编辑
gitlab_values.yaml:global: time_zone: 'America/New_York' -
保存文件并应用新值:
helm upgrade -f gitlab_values.yaml gitlab gitlab/gitlab
-
编辑
docker-compose.yml:version: "3.6" services: gitlab: environment: GITLAB_OMNIBUS_CONFIG: | gitlab_rails['time_zone'] = 'America/New_York' -
保存文件并重启 GitLab:
docker compose up -d
-
编辑
/home/git/gitlab/config/gitlab.yml:production: &base gitlab: time_zone: 'America/New_York' -
保存文件并重启 GitLab:
# For systems running systemd sudo systemctl restart gitlab.target # For systems running SysV init sudo service gitlab restart