Docker 安装gitlab私人Git仓库并迁移本地仓库

注意gitlab非常吃内存, 要修改配置文件 减少内存占用 (ps. 具体配置方式忘了…)

创建Gitlab容器

docker run --detach \
    --hostname 47.105.146.112 \
    --publish 8443:443 --publish 8081:8081 --publish 8022:22 \
    --name gitlab \
    --restart always \
    --volume /home/gitlab/config:/etc/gitlab \
    --volume /home/gitlab/logs:/var/log/gitlab \
    --volume /home/gitlab/data:/var/opt/gitlab \
    gitlab/gitlab-ce:latest

Git仓库迁移

  1. 从原地址克隆一份裸版本库
    git clone --bare http://xxxg@192.168.0.254:10010/r/~admin/server.git

  2. 新的 Git 服务器上创建一个新项目

  3. 假设你的remote是origin,用git remote set_url 更换地址
    git remote set-url origin http://47.105.146.112:8081/root/iotserver.git

  4. 以镜像推送的方式上传代码到 GitCafe 服务器上
    cd iotserver.git
    git push --mirror http://47.105.146.112:8081/root/iotserver.git

  5. 删除本地代码
    cd ..
    rm -rf project_name.git

更多推荐