Documents Address: https://gitea.io/zh-cn/
installation
docker way:
docker pull gitea/gitea:latest # 拉取 Gitea 镜像
sudo mkdir -p /var/lib/gitea # 创建一个目录作为数据存储
docker run -d --name=gitea -p 10022:22 -p 10080:3000 -v /var/lib/gitea:/data gitea/gitea:latest
# 10022 为容器内部ssh端口绑定到主机端口10022
# 10080 为容器内部的服务端口绑定到主机端口10080
Browser to access http: // hostname: 10080 / see git page.
Configuration instructions
Configuration Documentation Address: https://docs.gitea.io/zh-cn/config-cheat-sheet/
/ Var / lib / gitea directory structure:
/var/lib/gitea
- git
- gitea
- conf
-app.ini # 可直接修改该配置文件
-ssh
Because it is docker way to start the configuration file to take effect in the container, so you need to change server configuration HTTP_ADDR, HTTP_PORT, SSH_PORT local default configuration: HTTP_ADDR = 127.0.0.1, HTTP_PORT = 3000, SSH_PORT = 22, for container use.
API access
API access to documents Address:
api access enabled by default, can be adjusted ENABLE_SWAGGER closed api access in the configuration file.
When using api, authentication is required to access by normal, there are two authentication methods:
url query parameters mode
Specified token = ...
Specify access_token = ...
url to access Example:
http://120.132.27.75:31004/api/v1/admin/users?token=1f56a367be293111de36f17f15259fd161d28478
http header mode
Specify Authorization: token ...
Examples
curl -X POST "http://localhost:4000/api/v1/repos/test1/test1/issues" \ -H "accept: application/json" \ -H "Authorization: token 65eaa9c8ef52460d22a93307fe0aee76289dc675" \ -H "Content-Type: application/json" -d "{ \"body\": \"testing\", \"title\": \"test 20\"}" -i
More than two ways token, access_token, Authorization: token are the same, available in Gitea web interface: Settings | Applications | Generate New Token