Gogs搭建自己的源代码仓库

官方网站:https://gogs.io
官方仓库:https://github.com/gogs

安装方式

这里为了节约时间,我选择二进制安装。详细步骤:

1、 创建git用户

$ useradd git
$ passwd git          //设置密码(xxxxx) 

2、 下载解压gogs
默认工作目录在:/home/git/

$ su git

$ cd ~
$ wget  https://dl.gogs.io/0.11.91/gogs_0.11.91_linux_amd64.zip
$ unzip gogs_0.11.91_linux_amd64.zip         # unzip 命令不可用的话需先安装

3、 配置gogs守护进程模式
切回root用户拷贝文件

su root
cd /home/git/gogs
#拷贝服务
sudo cp ./scripts/systemd/gogs.service /usr/lib/systemd/system/
#拷贝到init.d
sudo cp ./scripts/init/centos/gogs /etc/init.d/
#给予可执行权限
chmod +x /etc/init.d/gogs
#设置开机启动服务
systemctl enable gogs.service
#运行服务
systemctl start gogs.service

如果运行失败,请给于目录权限:
chmod -R 777 gogs,然后注意运行的用户。
4、 其他命令:

 #停止
systemctl stop
#状态
systemctl status
#重启
systemctl restart
#禁用服务
systemctl disable
#重载系统所有服务
systemctl daemon-reload

相关文档:https://www.jianshu.com/p/a6be0f87f0c8

最后修改:2020 年 03 月 02 日 12 : 07 AM
如果觉得我的文章对你有用,请随意赞赏

发表评论