在树莓派上安装gogs git服务器

在树莓派上安装gogs git服务器

  • 创建git用户:

    adduser git

  • 下载gogs:

    wget https://dl.gogs.io/0.11.79/gogs_0.11.79_raspi2_armv6.zip

  • 解压到git用户目录:

    unzip gogs_0.11.79_raspi2_armv6.zip

  • 修改Gogs service配置文件:

    nano /home/git/gogs/scripts/init/debian/gogs

    “可能自己目录不一样”

  • 切会root账户然后复制到/etc/init.d/

    cp /home/git/gogs/scripts/init/debian/gogs /etc/init.d/

  • 增加执行权限

    sudo chmod +x /etc/init.d/gogs

  • 修改server

    nano /home/git/gogs/scripts/systemd/gogs.service

    可能需要修改路径等

  • 复制server

    cp /home/git/gogs/scripts/systemd/gogs.service /etc/systemd/system/

  • 启动Gogs

    service gogs start

    systemctl enable gogs
    systemctl start gogs

  • 停止server

    service gogs stop

    systemctl stop gogs

  • 重启sever

    service gogs restart

    systemctl restart gogs

  • 查看启动状态

    systemctl status gogsservice gogs status

  • 在自己浏览器上配置Gogs, localhost替换成自己的ip地址

    http://localhost:3000/install

  • 有关Gogs的配置文件在/home/git/gogs/custom/conf/app.ini里面

出现以下错误
重启gogs未自动启动

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
root@raspberrypi:/home/git/gogs# sudo systemctl enable gogs
Synchronizing state for gogs.service with sysvinit using update-rc.d...
Executing /usr/sbin/update-rc.d gogs defaults
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_CTYPE = "UTF-8",
LANG = "en_GB.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_GB.UTF-8").
Executing /usr/sbin/update-rc.d gogs enable
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_CTYPE = "UTF-8",
LANG = "en_GB.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_GB.UTF-8").

执行 export LC_ALL=en_GB.UTF-8