This is a creation in Article, where the information may have evolved or changed.
I. Introduction of Gogs
Gogs (Go git service) is an easy-to-build, self-help git services.
Gogs's goal is to create the simplest, fastest, and easiest way to build self-service Git services. Using go language development enables Gogs to be distributed through standalone binaries and supports all platforms supported by the go language, including Linux, Mac OS X, Windows, and ARM platforms.
For more information, see.
This article records the simple construction of the Gogs system in the network, this link for the intranet domain name do not click.
Second, the installation process
1. Install git
sudo Install git
2. Create a user
sudo adduser git
....
Su git
CD ~
Password: qwe
3. Download the latest version of Gogs
wget https://Dl.gogs.io/gogs_v0.8.10_linux_amd64.zip
Unzip./Gogs_v0.8.10_linux_amd64.zip
4. Running Gogs
./gogs Web
Then open the browser, http://server ip:3000/, the default is to enter the installation configuration interface, for simple configuration.
III. Configuration and operation
1. Running in the background
If you want to run in service mode in the background, first copy the/home/git/gogs/scripts/init/debian/gogs file to the/etc/init.d/directory, switch back to the original user ctrl+d, and increase the run permissions sudo chmod +x/etc/init.d/gogs, and modify the file as follows:
path=/sbin:/usr/sbin:/bin:/usr/Bindesc="Go Git Service"NAME= Gogsserviceverbose=yespidfile=/var/run/$NAME. Pidscriptname=/etc/init.d/$ Nameworkingdir=/home/git/gogs #这个根据自己的目录修改DAEMON= $WORKINGDIR/$NAMEDAEMON _args=" web"user =git #如果运行gogs不是用的这个用户, modify corresponding users
2. Custom Configuration
The first time you open an app, you can configure the Web interface, and then modify it in the/home/git/gogs/custom/conf/app.ini file, which you can refer to here. I've mostly changed here.
app_name = Cloud Copper Code management platform-git-Gogsrun_user=Gitrun_mode=Prod[database]db_type=Sqlite3host=127.0.0.1:3306NAME=Gogsuser=rootpasswd=Ssl_mode=Disablepath= data/Gogs.db[repository]root=/home/git/gogs-Repositories[server] #修改了域名, which is the domain used to generate the SSH protocol address that GIT uses by default=Git.yncic.comHTTP_PORT= the#修改了应用目录, this is the root_url for creating a git library URL connection.= http://git.yncic.com/Disable_ssh =falseSsh_port= AOffline_mode=false[mailer]enabled=false[Service]register_email_confirm=falseEnable_notify_mail=falsedisable_registration=falseEnable_captcha=trueRequire_signin_view=false#激活了AVATAR头像的本地缓存, AVATAR avatar is the wall Enable_cache_avatar by default=true[picture] #修改了GRAVATAR从多说缓存取照片GRAVATAR_SOURCE=Duoshuodisable_gravatar=false[Session]provider=file[Log]mode=file Level=Info[security]install_lock=trueSecret_key= D6LO2U0EDD4W2PL
3. Reverse Proxy
In order to bind the domain name, need to do reverse proxy, but because installed in the Binami Redmine set up the issue management system of the server, so used Bitnami provided apache2 do reverse proxy, in/opt/redmine-2.3.1-0/ apache2/conf/httpd.conf file was last added:
<virtualhost *:> ServerAdmin webmaster@domain.tld ServerName git.yncic.com Proxyrequests Off <proxy *> Order deny,allow allow from all </Proxy> /http:///localhost:3000/ proxypassreverse/http:// Localhost:3000/</VirtualHost>
This is still a bit of a problem, add this after the original application also jumped to the gogs, and finally added a section in the back, the problem is solved, but do not know why:
<virtualhost *:> ServerAdmin webmaster@domain.tld ServerName qa.yncic.com Proxyrequests Off <proxy *> Order deny,allow allow from all </Proxy> /http:///localhost:8080/ proxypassreverse/http:// localhost:8080/</VirtualHost>
4.LDAP Certified Configuration
In authorized authentication Management-Add a new source: