跳至主要內容

Gitlab

大约 2 分钟

Gitlab


配置 access_token 使用 https clone 仓库

git - Using GitLab token to clone without authentication - Stack Overflowopen in new window
Personal access tokens | GitLabopen in new window
执行Git命令时出现各种 SSL certificate problem 的解决办法_officercat的博客-CSDN博客open in new window


打开 Gitlab->偏好设置->访问令牌 配置一个权限全开的令牌, 点击 创建个人访问令牌 后会出现一个访问令牌字符串, 记录下该字符串, 本文之后将该字符串称为 access_token

image-20221213112006572

image-20221213112039734

在本地添加一条 git 配置, 取消 ssl 验证

git config --global http.sslVerify false

然后即可使用 https + access_token clone 仓库了

git clone https://oauth2:[access_token]@gitlab.xxx.com/xxxx.git

其实就是在仓库的 https clone 链接中的 https:// 后加上 oauth2:[access_token] 再把后面的链接拼接上即可


Gitlab 搭建(想了想不想维护, 就没再搭了)

GitLab installation minimum requirements | GitLabopen in new window

Ubuntu20.04 搭建 gitlab 服务 - 知乎 (zhihu.com)open in new window

配置参考

Supported operating systems | GitLabopen in new window


创建工作目录

# 创建 gitlab 工作目录
mkdir xxx
cd xxx

安装 docker 并拉取官方镜像

ubuntu安装docker详细步骤 - 腾讯云开发者社区-腾讯云 (tencent.com)open in new window

Docker 入门指南:如何在 Ubuntu 上安装和使用 Docker - 卡拉云 (kalacloud.com)open in new window

安装所需工具包

sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent  software-properties-common

更新现有的软件包列表

sudo apt-get update

然后将官方 Docker 版本库的 GPG 密钥添加到系统中:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

将 Docker 版本库添加到APT源:

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"

用新添加的 Docker 软件包来进行升级更新。

sudo apt update

确保要从 Docker 版本库,而不是默认的 Ubuntu 版本库进行安装:

apt-cache policy docker-ce

安装 Docker :

sudo apt install docker-ce

现在 Docker 已经安装完毕。我们启动守护程序。检查 Docker 是否正在运行:

sudo systemctl status docker

系统方面支持