Gogs taught you use to build private git repository

I had wanted to build a private warehouse on Github, but found only set three contributors.

Country code can only be set five Cloud.

Accidentally saw the use of gogs can build PW, just happen to have a spare server, then open dry!

https://gogs.io/

gogs

1, install git

yum install git

2, Installing MySQL

The installation process will be omitted.

After installing MySQL login as follows:

create database gogs default character set utf8mb4 collate utf8mb4_unicode_ci;

# 这里我新建了一个用户用来访问gogs数据库
CREATE USER 'pig'@'%' IDENTIFIED BY 'xxxx';
GRANT ALL ON gogs.* TO 'pig'@'%';

3, installation gogs

3.1 Create a git user

Recommends using git users, because the default configuration file gogs git users.

useradd git
passwd git设置密码

3.2 download, unzip gogs

su git
cd 

wget https://dl.gogs.io/0.11.29/linux_amd64.zip
# unzip 命令不可用的话需先安装
unzip linux_amd64.zip

3.3 gogs

vim /home/git/gogs/scripts/init/debian/gogs

PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="GoGs Git Service"
NAME=gogs
SERVICEVERBOSE=yes
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
WORKINGDIR=/home/git/gogs #根据自己的目录修改
DAEMON=$WORKINGDIR/$NAME
DAEMON_ARGS="web"
USER=git  #修改对应用户

3.4 cut back to root, copy files and services

#拷贝到init.d下
cp /home/git/gogs/scripts/init/debian/gogs /etc/init.d/
#添加可执行权限
chmod +x /etc/init.d/gogs
#拷贝service
cp /home/git/gogs/scripts/systemd/gogs.service /etc/systemd/system/

3.5 start

systemctl start gogs.service 

4, configuration gogs

At this time, ip:3000you can visit

PS Ali cloud pit

Ali cloud host is unable to access the default port of 3000, the solution

① Ali cloud log on to the console, into their own cloud hosting management page

② Click the "firewall"

Firewall

③ add port 3000 access rule

Add access rules

OK, the page before and then you can continue to visit.

First visit Gogs, browser enter the installation page, complete the fields as shown in Figure

Database Configuration

Other configurations

Click to install gogs, after a successful installation directly into the gogs home page, where you can sign up or log in, exactly like a normal website.

If there is no administrator configures the installation page, then the first registered users automatically become the default administrator, after registration of users are ordinary users.

Detailed profiles

Configuration files are located in:

/home/git/gogs/custom/conf/app.ini

Which explains the parameters can Tell me what network: https://gogs.io/docs/advanced/configuration_cheat_sheet

User registration is prohibited

For security system, consider banning the user registration, the account can only be created by an administrator.

DISABLE_REGISTRATION parameter set to true.

DISABLE_REGISTRATION = true

At this point you need to create an account on the page:

Management Panel

Create an account

So far, the basic set up is completed based on the Git gogs private warehouse.


reference:

https://www.jianshu.com/p/63206dad0afa
https://blog.csdn.net/qq_22638399/article/details/80658196
https://zhuanlan.zhihu.com/p/30798837
https://www.jianshu.com/p/28e8aa8f9ec4

Guess you like

Origin www.cnblogs.com/hoxis/p/11462959.html