注:CentOS7必须安装docker,docker-compose
1.docker拉取镜像
命令:
[root@localhost ~]# docker search gitlab-ce-zh
[root@localhost /]# docker pull twang2218/gitlab-ce-zh
创建文件夹,并创建docker-compose.yml
docker-compose.yml 配置
version: '3.1'
services:
gitlab:
image: 'twang2218/gitlab-ce-zh:11.1.4'
container_name: "gitlab-ce"
restart: always
privileged: true
hostname: 'gitlab-ce'
environment:
TZ: 'Asia/Shanghai'
GITLAB_OMNIBUS_CONFIG: |
external_url 'http://192.168.33.9'
gitlab_rails['time_zone'] = 'Asia/Shanghai'
gitlab_rails['smtp_enable'] = true
gitlab_rails['gitlab_shell_ssh_port'] = 2222
unicorn['port'] = 8989
ports:
- '80:80'
- '443:443'
- '2222:22'
volumes:
- /usr/local/docker/gitlab-ce/config:/etc/gitlab
- /usr/local/docker/gitlab-ce/data:/var/opt/gitlab
- /usr/local/docker/gitlab-ce/logs:/var/log/gitlab
首次启动时间会有点久大概5-10分钟左右
持续访问路径http://192.168.33.9
直到出现以下界面即可
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-IN49sTjk-1640659660963)(http://192.168.33.159:81/cdn/images/20191106110303.png)]
访问成功,需要修改root 密码,根据自己需求进行更改最少8位数,本次默认为12345678
修改成功后,使用root 账号登录,密码12345678
登录成功
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-NeGLKuCJ-1640659660963)(http://192.168.33.159:81/cdn/images/20191106110602.png)]
2.git基本操作命令
克隆 git clone +地址
git clone ssh://git@192.168.33.185:2222/ynxx-config/itoken-config.git
拉取
git pull
提交
git status 查看状态
git add . 提交至暂存区,注意有 .
git commit -m ""(提交备注,双引号内写备注)
git push origin master 将本地的master分支推送到origin主机
更新
git pull 更新
拉取或提交代码遇到报错
Please commit your changes or stash them before you merge.
git stash
git pull
git stash pop
- git stash:
备份当前的工作区的内容,从最近的一次提交中读取相关内容,让工作区保证和上次提交的内容一致。同时,将当前的工作区内容保存到Git栈中。 - git stash pop:
从Git栈中读取最近一次保存的内容,恢复工作区的相关内容。由于可能存在多个Stash的内容,所以用栈来管理,pop会从最近的一个stash中读取内容并恢复。 - git stash list: 显示Git栈内的所有备份,可以利用这个列表来决定从那个地方恢复。
- git stash clear: 清空Git栈。此时使用gitg等图形化工具会发现,原来stash的哪些节点都消失了。