The goal of gogs is to build a self-service git service in the simplest, fastest and easiest way. Using go language development enables gogs to be distributed through independent binary, and supports all platforms supported by go language, includingLinux, Mac OS X, windows and arm platforms.
Create git users
Setting sudo for git users
[[email protected] ~]# visudo
git ALL=(ALL) NOPASSWD: ALL
Download and configure the basic environment
[[email protected] ~]# yum -y install tar wget git mariadb mariadb-server
Set MariaDB to start, and start MariaDB service
[[email protected] ~]# systemctl enable mariadb –now
Create gogs database
Switch to git user
[[email protected] ~]# su – git
[[email protected] ~]$ mysql -u root -e “CREATE DATABASE IF NOT EXISTS gogs CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;”
|[[email protected] ~]$ mysql -u root -e “show databases;”|
Create database gogs user and grant access to gogs database:
Check whether the user gogs is added and whether all access rights are granted.
Download gogs installation package
From the website of gogshttps://gogs.io/docs/installa…Download the installation package of the corresponding operating system.
Start gogs and open the port of firewall
Open the browser and enter the IP address of the server. The port is 3000. Database user and password, using just created“ Use “URL” to fill in the IP address of the gogs server. Then click Install now.
After that, enter the login interface, and we can create a new user.
Enter the registration page to register users.
After registration, log in, we can click my warehouse and create the first one.
Copy the warehouse address, and then download the warehouse from your own operating system
Create a description file in the warehouse and upload it to the remote warehouse.
[[email protected] ~]# git clone http://192.168.60.137:3000/user01/example01.git
Cloning into ‘example01’…
warning: You appear to have cloned an empty repository.
[[email protected] ~]# cd example01/
[[email protected] example01]# echo “This is example01’s README” > README.md
[[email protected] example01]# git add .
[[email protected] example01]# git config –global user.name user01
[[email protected] example01]# git config –global user.email [email protected]
[[email protected] example01]# git commit -m “add a README.md”
[master (root-commit) 9d7df1d] add a README.md
1 file changed, 1 insertion(+)
create mode 100644 README.md
[[email protected] example01]# git push
Enumerating objects: 3, done.
Counting objects: 100% (3/3), done.
Writing objects: 100% (3/3), 240 bytes | 240.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)
Username for ‘http://192.168.60.137:3000′: user01
Password for ‘http://[email protected]:3000′:
- [new branch] master -> master
The upload is successful in the remote warehouse.
Gogs can also be deployed by using docker, vagrant and helm charts based on kubernetes.