gitlab安装配置使用

gitlab安装配置使用

Docker install

gitlab-ce为稳定版本,后面不填写版本则默认pull最新latest版本

$ docker pull gitlab/gitlab-ce
docker pull twang2218/gitlab-ce-zh 汉化版

sudo docker run  --name gitlab \
  -itd \
  -p 443:443 -p 80:80 -p 222:22 \
  --privileged=true \
  -v /Users/sweet/gitlab/config:/etc/gitlab:Z \
  -v /Users/sweet/gitlab/logs:/var/log/gitlab:Z \
  -v /Users/sweet/gitlab/data:/var/opt/gitlab:Z \
  gitlab/gitlab-ce

 --restart always \

sudo docker exec -it gitlab /bin/bash
You can also just edit /etc/gitlab/gitlab.rb:
sudo docker exec -it gitlab editor /etc/gitlab/gitlab.rb

# gitlab.rb文件内容默认全是注释
$ vim /home/gitlab/config/gitlab.rb

# 配置http协议所使用的访问地址,不加端口号默认为80
external_url 'http://192.168.199.231'

# 配置ssh协议所使用的访问地址和端口
gitlab_rails['gitlab_ssh_host'] = '192.168.199.231'
gitlab_rails['gitlab_shell_ssh_port'] = 222 # 此端口是run时22端口映射的222端口
:wq #保存配置文件并退出
# 重启gitlab容器
$ docker restart gitlab

====================
sudo apt-get install -y curl openssh-server ca-certificates 依赖
sudo apt-get install -y postfix 发送邮件
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.deb.sh | sudo bash 下载
sudo EXTERNAL_URL=“http://gitlab.example.com”apt-get install gitlab-ee 安装
首次访问时,您将被重定向到密码重置屏幕。提供初始管理员帐户的密码,您将被重定向回登录屏幕。使用默认帐户的用户名root登录

1)进入文件gitlab.rb,修改EXTERNAL_URL地址和端口号

sudo vim /etc/gir/gitlab.rb

sudo vim /etc/gitlab/gitlab.rb

EXTERNAL_URL 修改为本机服务地ip地址,并分配端口号(例如:4567)。

2)重新配置 sudo gitlab-ctl reconfigure

3)开启服务 service sshd start service postfix start

4)查看运行状态: sudo gitlab-ctl status 如果run正常,则成功
Git global setup

git config –global user.name “Administrator”
git config –global user.email “admin@example.com”

Create a new repository

git clone http://e132f243a5fe/shanpai/config.git
cd config
touch README.md
git add README.md
git commit -m “add README”
git push -u origin master

Push an existing folder

cd existing_folder
git init
git remote add origin http://e132f243a5fe/shanpai/config.git
git add .
git commit -m “Initial commit”
git push -u origin master

Push an existing Git repository

cd existing_repo
git remote rename origin old-origin
git remote add origin http://e132f243a5fe/shanpai/config.git
git push -u origin –all
git push -u origin –tags

ERROR

Url is blocked: Requests to the local network are not allowed
Admin area => Settings => Network ,然后点击 Outbound requests 右边 的“expand”按钮,选中Allow requests to the local network from web hooks and services

You must be logged in to post a comment