Up and running private GIT server with GUI
10 years ago I have installed SVN Избавляемся от Team Foundation Server - ставим Subversion and it still working fine. Also I have a lot various account in different GIT server, also many times I have installed private Windows GIT server in local network, but now I need to install my own private GIT server with full web access and full Github functionality. There are a lot of GIT server GUI, even better than Github, for example https://secure.phabricator.com/ (with chatting room, forum, useful links in dashboard, Q&A and mockup tools and so on), but in my case I need a simple clone of Github. For this purpose I select https://gogs.io/.
And below I want to show full cyrcle how to install and use GIT with GOGS GUI in Ubintu.
So, first step is prepare Ubuntu
# sudo apt-get update # sudo apt-get upgrade # sudo reboot
1. Install and tune MySQL.
Install MySQL
# sudo apt install mysql-server # sudo mysql_secure_installation # sudo systemctl status mysql.service
![](/PrivateGIT/MySql-1_1.png)
![](/PrivateGIT/MySql-2_1.png)
Set remote mode on, try to connect remotelly. Not need step in common, but in my case this step is needed.
# cd /etc/mysql/mysql.conf.d # sudo nano mysqld.conf # sudo systemctl restart mysql.service
![](/PrivateGIT/MySql-3_1.png)
![](/PrivateGIT/MySql-4_1.png)
![](/PrivateGIT/MySql-5_1.png)
![](/PrivateGIT/MySql-6_1.png)
Crete new user, create database, grant user access to database.
# mysql -u root -p
![](/PrivateGIT/MySql-7_1.png)
![](/PrivateGIT/MySql-8_1.png)
![](/PrivateGIT/MySql-9_1.png)
![](/PrivateGIT/MySql-10_1.png)
![](/PrivateGIT/MySql-11_1.png)
2. Install and check GIT engine.
# sudo apt-get install nginx git nano fcgiwrap apache2-utils -y
Access control to GIT may be organize by many ways. First way is described in original GIT documentation https://git-scm.com/book/en/v2/Git-on-the-Server-Setting-Up-the-Server. In this case I have generated public key in my GIT client, created new account in server add add my public key to GIT server account.
# sudo adduser git # su git # cd # pwd # mkdir .ssh && chmod 700 .ssh # touch .ssh/authorized_keys && chmod 600 .ssh/authorized_keys # cd .ssh # nano authorized_keys
![](/PrivateGIT/Git-1_1.png)
![](/PrivateGIT/Git-2_1.png)
Second way is access control by htpasswd and nginx. In this case I have created user Cryprochest and access to GIT repository by password stored in htpasswd.
sudo mkdir /var/www/html/git sudo chown -R www-data:www-data /var/www/html/git sudo nano /etc/nginx/sites-available/default sudo nginx -t
This is my nginx config.
![](/PrivateGIT/Nginx-1_1.png)
sudo htpasswd -c /var/www/html/git/htpasswd cryptochest sudo systemctl restart nginx cd /var/www/html/git sudo mkdir frontend.git cd frontend.git sudo git --bare init sudo git update-server-info sudo chown -R www-data:www-data . sudo chmod -R 755 .
![](/PrivateGIT/Git-3_1.png)
![](/PrivateGIT/Git-4_1.png)
This is full workable solution, but GUI is nothing at all. I check how private GIT repository is working and check size after Git push.
# ls -la /var/www/html/git/frontend.git/objects/pack
![](/PrivateGIT/Git-5_1.png)
![](/PrivateGIT/Git-6_1.png)
![](/PrivateGIT/Git-7_1.png)
![](/PrivateGIT/Git-8_1.png)
# cd /var/www/html/git/frontend.git # git log
![](/PrivateGIT/Git-9_1.png)
3. Install clone of Github.
So, if GIT is working and MySQL is working too, we can go ahead and install GOGS.
First step is download Gogs.
# sudo curl https://dl.gogs.io/0.12.3/gogs_0.12.3_linux_amd64.tar.gz | tar -xz
![](/PrivateGIT/Gogs-1_1.png)
![](/PrivateGIT/Gogs-2_1.png)
Than need to start gogs.
# ./gogs web .
![](/PrivateGIT/Gogs-3_1.png)
In first start you usually will receive various errors, you can check it by
# cat /log/gogs.log # ./gogs --help # ./gogs web --help # ps -aux | grep gogs # sudo netstat -nlp | grep :22 # sudo ss -lptn
![](/PrivateGIT/Gogs-4_1.png)
![](/PrivateGIT/Gogs-5_1.png)
After first start gogs configuration file will be created and you will see gogs setup web form.
![](/PrivateGIT/Gogs-6_1.png)
![](/PrivateGIT/Gogs-7_1.png)
If something going wrong you can delete this file and fry to start from beginning.
![](/PrivateGIT/Gogs-8_1.png)
Instalation configuration is huge and main mistake in documentation (in m opinion) is statement that admin account in last section is optional and not needed.
![](/PrivateGIT/Gogs-9_1.png)
But finally, I'm sure, you will receive workable config and will be redirected inside gogs.
![](/PrivateGIT/Gogs-10_1.png)
Thats it, installation is done.
4. Configure Gogs as service.
# cd /etc/systemd/system # ls -la # sudo nano gogs.service
This is my gogs.service config
![](/PrivateGIT/Service-1_1.png)
# sudo systemctl daemon-reload # sudo systemctl start gogs # sudo systemctl enable gogs
Thats it, since than you will enjoy own private clone of Microsoft Github, but without Microsoft.
![](/PrivateGIT/Gogs-11_1.png)
![](http://forum.vb-net.com/GetTopicCount.png?id=61a8972f-e1f5-4136-9341-b8fe1c94df26)
<SITEMAP> <MVC> <ASP> <NET> <DATA> <KIOSK> <FLEX> <SQL> <NOTES> <LINUX> <MONO> <FREEWARE> <DOCS> <ENG> <CHAT ME> <ABOUT ME> < THANKS ME> |