





























官方文档: https://docs.gitlab.com/ee/install/docker.html#expose-gitlab-on-different-ports
export GITLAB_HOME=/srv/gitlabstart.sh#!/bin/bash
export GITLAB_HOME=/srv/gitlab
sudo docker run --detach \
--privileged \
--hostname gitlab.example.com \
--publish 8980:8980 --publish 8922:22 \
--name gitlab \
--network bridge \
--volume $GITLAB_HOME/config:/etc/gitlab:Z \
--volume $GITLAB_HOME/logs:/var/log/gitlab:Z \
--volume $GITLAB_HOME/data:/var/opt/gitlab:Z \
--shm-size 256m \
gitlab/gitlab-ee:latest
配置文件位置: /etc/gitlab/gitlab.rb
务必保证
/etc/gitlab/gitlab.rb配置文件中的external_url是真实有效的可访问的地址
重启使配置生效
sudo docker restart gitlab
Gitlab 默认使用 80, 443, 22 等端口, 若不使用默认端口,则需修改配置文件 /etc/gitlab/gitlab.rb
若设置Web 端口
# For HTTP
external_url "http://gitlab.example.com:8929"
# or
# For HTTPS (notice the https)
# external_url "https://gitlab.example.com:8929"
若设置ssh端口
gitlab_rails['gitlab_shell_ssh_port'] = 2289
重新配置gitlab
gitlab-ctl reconfigure
首先需要登录gitlab容器内部,如果gitlab容器的名称为 gitlab, 进入容器
docker exec -it gitlab bash
gitlab-rake "gitlab:password:reset"
打开rails控制台
gitlab-rails console
查找用户
By username
user = User.find_by_username 'root'
By user ID(root 用户id为1)
user = User.find(1)
By email address
user = User.find_by(email: 'root@example.com')
重置密码
设置随机密码
new_password = ::User.random_password
user.password = new_password
user.password_confirmation = new_password
user.password_automatically_set = false
设置指定密码
new_password = 'examplepassword'
user.password = new_password
user.password_confirmation = new_password
user.password_automatically_set = false
保存
user.save!
退出
exit
If the new password doesn’t work, it might be an email confirmation issue. You can attempt to fix this issue in a Rails console. For example, if a new root password isn’t working:
user = User.find(1)
user.skip_reconfirmation!
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。