### main提交

git checkout remotes/origin/main
git switch -c main
git push --set-upstream origin main

### git添加子模块

git submodule add http://124.70.149.18:10880/service/comm.git
git submodule update --init --recursive

git submodule update --recursive --remote
git checkout master
git pull

### 线上服务器

Host huawei-prod02(官网)
    HostName 124.71.139.24
    User root
    Port 22
    #Password MmxInfish@2020

华为云：
infishCn
Mmxiang@2022

### docker 账号

registry.cn-chengdu.aliyuncs.com
infish2018:infish@2022

docker login -u cn-east-3@SUEDSZR0SDZKPBL3S4AZ -p 2ff86159dfe08494c19696a7383f397ee271ead2646d08af5ef5059b3f8df077 swr.cn-east-3.myhuaweicloud.com

ssh root@124.71.139.24

### json美化

ctrl+shift+j

### json转go代码

F1 paste json ...

远程 HEAD 指向一个不存在的引用，无法检出
git branch -a
git checkout remotes/origin/main
git switch -c main

## 同步时区

vim /etc/crontab
2 15 * * * root ntpdate cn.ntp.org.cn

subcribe queencount.service

## docker无法正常停止

systemctl stop docker.socket
systemctl stop docker.service

systemctl daemon-reload
systemctl restart docker.service
service docker start

## docker更改数据盘

1. 停止docker服务
systemctl stop docker.socket
systemctl stop docker.serivce

2. 创建目标目录
mkdir -p /data/docker

3. 同步数据
rsync -avz /var/lib/docker/ /data/docker

4. 找到启动配置
find / -name docker.service
systemctl status docker

5. 更改配置
vim /lib/systemd/system/docker.service
ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock --graph=/data/docker

6. 配置生效、重启docker
systemctl daemon-reload
systemctl start docker.service

7. 查看是否生效
docker info

/usr/lib/systemd/system/docker.service


## yarn dev nuxt.js 出错
NODE_OPTIONS=--openssl-legacy-provider yarn dev

## navicat 试用

rm -rf ~/.config/dconf/user
rm -rf ~/.config/navicat

## linux 下编译windows可执行文件

CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o train-service.exe main.go

## git lfs 使用

> [https://git-lfs.com/]

1. 安装`https://github.com/git-lfs/git-lfs/releases/download/v3.3.0/git-lfs-linux-amd64-v3.3.0.tar.gz`,解压进入`sudo ./install.sh`
2. git lfs track "*.zip"
3. git add .gitattributes,commit,push

## windows 安装mongo

> 查看端口被哪个进程占用 netstat -ano |findstr "端口号" 杀死进程 taskkill /f /t /im "进程id或者进程名称"

1. pack-oliseal-train文件夹中安装,安装路径自定义为`D:/pack-oilseal-train/mongo`
2. 将mongo mongosh bin目录配置环境变量 `D:\pack-oilseal-train\mongo\MongoDB\Server\6.0\bin`,`D:\pack-oilseal-train\mongo\mongosh-1.6.1-win32-x64\bin`
3. 命令行执行mongod
4. 启动服务 net start MongoDB
5. 执行mongosh
6. use admin
7. db.createUser({user:"admin",pwd:"admin123",roles:[{"role":"userAdminAnyDatabase","db":"admin"}]})
8. db.auth("admin","admin123")
9. db.createUser({user:"root",pwd:"oilseal-train",roles:["dbOwner"]})
