使用Gitea搭建Git服务器

如何搭建,官方文档已经写的很简单了,而且有中文的,本文以二进制的为例,【官方文档】:https://docs.gitea.io/zh-cn/install-from-binary/

wget -O gitea https://dl.gitea.io/gitea/1.12.2/gitea-1.12.2-linux-amd64
chmod +x gitea

在执行了以上步骤之后,你将会获得 gitea 的二进制文件,在你复制到部署的机器之前可以先测试一下。在命令行执行完后,你可以 Ctrl + C 关掉程序。

./gitea web

执行gitea的启动
此时可以进入http://ip+3000(默认端口)登录。

【注意】:
1、检查服务器的3000端口开放情况;
2、如果是云主机的话检查安全组3000端口开放情况。
3、如此采用 SQLite, MySQL 和 PostgreSQL等数据库,请提前安装好数据库。
 

 

附1:配置文档(参考)

以实际的情况为准。

RUN_USER = root
RUN_MODE = prod
APP_NAME = Gmem Gitea
[repository]
ROOT = /opt/gitea/repos
[server]
PROTOCOL         = https
DOMAIN           = git.gmem.cc
HTTP_ADDR        = 0.0.0.0
HTTP_PORT        = 3443
; 证书需要完整的链
CERT_FILE        = /etc/letsencrypt/live/git.gmem.cc/fullchain.pem
KEY_FILE         = /etc/letsencrypt/live/git.gmem.cc/privkey.pem
SSH_DOMAIN       = git.gmem.cc
ROOT_URL         = https://git.gmem.cc/
DISABLE_SSH      = false
SSH_PORT         = 22
LFS_START_SERVER = true
LFS_CONTENT_PATH = /opt/gitea/data/lfs
LFS_JWT_SECRET   = s52JAPPWiOFpp8CZiPHrlGeHWtwv6WCphZtBG5vNLE8
OFFLINE_MODE     = false
[mailer]
ENABLED = false
[service]
REGISTER_EMAIL_CONFIRM            = false
ENABLE_NOTIFY_MAIL                = false
DISABLE_REGISTRATION              = true
ENABLE_CAPTCHA                    = false
REQUIRE_SIGNIN_VIEW               = false
DEFAULT_KEEP_EMAIL_PRIVATE        = false
DEFAULT_ALLOW_CREATE_ORGANIZATION = true
DEFAULT_ENABLE_TIMETRACKING       = true
NO_REPLY_ADDRESS                  = noreply@gmem.cc
[picture]
DISABLE_GRAVATAR        = false
ENABLE_FEDERATED_AVATAR = false
[openid]
ENABLE_OPENID_SIGNIN = true
ENABLE_OPENID_SIGNUP = false
[session]
PROVIDER = file
[log]
MODE      = file
LEVEL     = Info
ROOT_PATH = /opt/gitea/log

附2:邮件配置(参考)

按网页流程配置了邮件,在后台测试的时候,邮件发送失败,需进入配置端。

检查配置路径,找到app.ini配置文档
./custom/conf/app.ini

[mailer]
ENABLED       = true
FROM          = gitea@mydomain.com
MAILER_TYPE   = sendmail
SENDMAIL_PATH = /usr/sbin/sendmail

检查修改,在后面加上端口号

[mailer]
ENABLED        = true
FROM           = gitea@mydomain.com
MAILER_TYPE    = smtp
HOST           = mail.mydomain.com:587
IS_TLS_ENABLED = true
USER           = gitea@mydomain.com
PASSWD         = `password`

附3:数据库问题(参考)

FQ:ERROR 1071 (42000): Specified key was too long; max key length is 767 bytes,处理
启用innodb_large_prefix
设置步骤

mysql> set global innodb_file_format = BARRACUDA;
Query OK, 0 rows affected (0.00 sec)
mysql> set global innodb_large_prefix = ON;
Query OK, 0 rows affected (0.00 sec)
THE END
点赞0 分享
抢沙发
头像
提交
头像

昵称

取消
昵称表情

    暂无评论内容