gitlab安装
参考文章
https://zhuanlan.zhihu.com/p/547052294
https://blog.csdn.net/dqfe123/article/details/122295781
# 系统 centos7
# 测试机关闭防火墙
systemctl stop firewalld && systemctl disable firewalld
# 安装依赖并运行postfix
yum -y install curl policycoreutils openssh-server openssh-clients postfix policycoreutils-python
systemctl start postfix
# gitlab包下载
wget http://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-15.2.0-ce.0.el7.x86_64.rpm
# rpm安装
rpm -ivh gitlab-ce-15.2.0-ce.0.el7.x86_64.rpm
# 配置项修改,测试安装,修改 external_url
vim /etc/gitlab/gitlab.rb
# 密码文件,第一次安装root密码存放位置
/etc/gitlab/initial_root_password
# 重载服务
gitlab-ctl reconfigure
# gitlab-ctl restart
#查看状态
gitlab-ctl status
接口调用实例
这里gitlab安装完成后,api文档地址为 http://localip/help/api/api_resources.md
python3调用
import json
import base64
import requests
class MyGitlabApi():
def __init__(self) -> None:
self.url = "http://localip/"
self.session = requests.session()
self.header = {
"Private-Token":"" # token
}
def projects(self):
"""
获取用户的projects信息
"""
url = self.url +"api/v4/projects/?per_page=100&page=1"
ret = self.session.get(url,headers = self.header)
# print(ret.status_code)
if 200

本文档详细介绍了GitLab的安装步骤,参考了相关技术博客,并提供了完成安装后的API接口调用实例,包括API文档的访问地址以及Python3的调用示例。
最低0.47元/天 解锁文章
1325

被折叠的 条评论
为什么被折叠?



