------------------------------------------------
常用命令
设置仓库
git init #创建或初始化仓库
git fetch --all #强制拉取所有分支
git config --global user.name "lei"
git config --global user.email "lmor@qq.com"
git remote add origin git@github.com:slbu/m.lbu.com.git
git clone git@github.com:slbu/m.lbu.com.git m.lbu.cn
上传代码
git add --all
git commit -m "提交记录"
git push --set-upstream origin develop
切换分支版本
git reset --hard 版本号
在github添加ssh密匙
ssh-keygen -t rsa -b 4096 -C "lmor@qq.com" -f ~/.ssh/id_rsa_shileide
vim ~/.ssh/config
Host github.com
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa_shileide
push代码
git add .
git commit -m "修改信息"
git push origin main
使用git的方式替换https
git config --global user.name "lei"
git config --global url."git@lab.yaozh.com:".insteadof "https://lab.yaozh.com/"
拉预发布
git fetch --all
git checkout -b master origin/master
git reset --hard origin/master
git pull origin master
拉测服
git fetch --all
git checkout -b develop origin/develop
git reset --hard origin/develop
git pull origin develop
------------------------------------------------
docker恢复gitlab
docker版本
Docker Compose version v2.27.1
docker-compose版本
Docker version 20.10.24, build 297e128
创建docker-compose
vim gitlab.yml
version: '3.8'services:
gitlab:
image: registry.cn-hangzhou.aliyuncs.com/leiuvn/lab:16.11.3-ce.0
container_name: gitlab
privileged: true
ports:
- "9980:80"
- "9922:22"
volumes:
- /opt/gitlab/etc:/etc/gitlab
- /opt/gitlab/log:/var/log/gitlab
- /opt/gitlab/opt:/var/opt/gitlab
restart: always
------------------------------------------------