1
插件管理[Gogs]
Mr Chen edited this page 2022-08-31 15:12:39 +08:00
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.

gogs使用说明

安装后,启动时默认时连接mysql
[database]
DB_TYPE  = mysql
HOST     = 127.0.0.1:3306
NAME     = gogs
USER     = gogs
PASSWD   = gogs
配置不正确会报错。
第一次启动才可以修改配置文件。

FQ

启动gogs后,如果要使用hook脚本同步代码,需要开启ssh端口。

  • 开启Gogs使用SSH
修改配置文件gogs/custom/conf/app.ini中内容:
DISABLE_SSH = false
改为
DISABLE_SSH = true
  • 生成新的SSH Key:
* 打开命令行工具

* 执行如下命令:
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

* 选择要保存的SSH Key的路径:
注意,这里不要选用默认的路径,会把之前生成的Key覆盖,选用新的路径:
Enter a file in which to save the key (/Users/you/.ssh/id_rsa): [Press enter]
比如说使用默认地址,但是名字使用id_rsa,路径如下:
/Users/you/.ssh/id_rsa

* 删除Gogs中原来的SSH Key:
在用户设置——>SSH密钥中可以看到之前添加的SSH Key,删除

* 将新生成的SSH Key添加到Gogs中: 复制/Users/you/.ssh/id_rsa.pub中的内容,添加到Gogs的SSH密钥中
这样一来,SSH远程登录服务器用的是原来的SSH Key,操作Gogs项目时用的是新生成的SSH Key。

id_rsa.pub内容,加入到你的gogs账户中ssh密钥管理中。