添加文件
This commit is contained in:
44
gitea/搭建与迁移.md
Normal file
44
gitea/搭建与迁移.md
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
[搭建]
|
||||||
|
在 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了!
|
||||||
|
|
||||||
Reference in New Issue
Block a user