This repository has been archived on 2026-01-07. You can view files and clone it, but cannot push or open issues or pull requests.
Files
docs/gitea/搭建与迁移.md
2025-07-12 10:11:07 +08:00

45 lines
1.7 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[搭建]
在 1Panel 上使用容器创建,首次创建时无法选择宿主机的目录映射,会自动生成:
"HostConfig": {
"Binds": [
"/etc/localtime:/etc/localtime:ro",
"/opt/1panel/apps/gitea/gitea/data:/data:rw",
"/etc/timezone:/etc/timezone:ro"
],
如果要备份gitea的数据可以在 1Panel 上启动定时任务,备份对应的宿主机目录 /opt/1panel/apps/gitea/gitea/data
如果是拉取镜像自己创建docker就可以指定宿主机目录比如映射到主机的cos目录或者把备份的目录还原回去。
git 提供 https 和 ssh的访问方式目前用 openresty 搭建反向代理同时把https解成http给 gitea提升安全性。
gitea 的ssh端口是222也可以放开防火墙使用ssh的方式更方便。
[迁移]
gitea 提供了迁移功能可以把原有的git工程直接迁移过来非常方便。
[使用]
与git保持相同。
不知道什么问题使用https方式无法提交代码。改为ssh方式。
首先修改git的ssh host进入到容器中找到 /data/gitea/conf/app.ini 修改
[server]
DOMAIN = git.easyprompt8.com
SSH_DOMAIN = git.easyprompt8.com
HTTP_PORT = 3000
ROOT_URL = https://git.easyprompt8.com/
重启让它生效。这样就能看到代码库的git路径是域名了。
在本地执行:
ssh-keygen -t rsa -b 4096 -C "oscar@easyprompt8.com"
把生成的 ~/.ssh/id_rsa.pub 的内容复制到 gitea一般是 设置-ssh那里
在本地创建 ~/.ssh/config 文件,内容为:
Host git.easyprompt8.com
Port 222
User git
保存,然后在命令行测试:
ssh -T git@git.easyprompt8.com
如果正常的话那就可以愉快的使用git了