The lightweigth github clone
Use command ./gogs help
to list gogs commands.
$ sudo -u postgres psql
postgres=# CREATE ROLE gogs_app WITH CREATEDB LOGIN ENCRYPTED PASSWORD 'VerySecretPassword';
postgres=# CREATE DATABASE gogs_db OWNER gogs_app;
Check database creation : postgres=# \l
Create gituser :
$ sudo adduser gituser
The binary of gogs is unziped in /home/gituser/
Please launch gogs as gituser.
$ sudo su gituser
$ /home/gituser/gogs/gogs web
Find the script to start gogs programmatically in Install/Templates/startgogs
in this repository. Put at the root of your gogs installation. Then, as gituser :
$ crontab -e
And add the line : @reboot /home/gituser/gogs/startgogs
When you start Gogs for the first time, Gogs shows a landing page when you can configure your installation.
Then, if you want to tweak your installation, you can do so by modifying the file custom/conf/app.ini
. For example, you can disable registration by modifying this line to DISABLE_REGISTRATION = true
. Then restart the server to reload configuration changes.
Use the gui to add the public ssh key. Go to settings.
Example of repository url using SSH :
ssh://gituser@192.168.1.35:6666/DricomDragon/CodingGameSolver.git
Gogs natively manages backups. Prefer to use gogs tools instead of squared wheels.
$ ./gogs backup --help
$ ./gogs restore --help
Beware : please ensure that the user gogs_app
has the same password on both instances ! You can change the password after the migration by using ALTER ROLE gogs_app ENCRYPTED PASSWORD 'NewPassword';
and by changing the db password in gogs/custom/conf/app.ini
.
Example :
sudo -u gituser /home/gituser/gogs/gogs backup --target /home/gituser/ ;
sudo mv /home/gituser/gogs-backup-2* /home/jovian/Local/Backup/Gogs/ ;
sudo chown jovian:jovian /home/jovian/Local/Backup/Gogs/gogs-backup-2*
/home/gituser/gogs/gogs-repositories/
Your previous installation is marked as old :
$ mv gogs gogs_old
Three folders matter :
$ cp -R gogs_old/{custom,data,log} gogs
Backup the gogs_db
from PostgreSQL.