zk_html/work/gitea-3.html

281 lines
26 KiB
HTML

<!doctype html>
<html>
<head>
<title>Zk | gitea-3</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Gentium+Plus&family=Lato&family=Ubuntu+Monodisplay=swap" />
<link rel="stylesheet" type="text/css" href="/style.css" />
<meta name="viewport" content="width=device-width" />
<meta charset="utf-8" />
</head>
<body>
<main>
<header>
<h1>Zk | gitea-3</h1>
</header>
<article class="content">
<h1 id="how-to-deploy-a-static-website-from-gitea-using-git-hooks">How To Deploy a Static Website from Gitea Using Git Hooks</h1>
<h3 id="introduction">Introduction</h3>
<p>The popular source code management system <a href="https://git-scm.com">Git</a> is quite flexible when it comes to allowing you to perform various tasks when actions are taken on a repository. For example, you might want to send an email when a feature branch is merged into your main branch, or log various Git actions to a file for tracking.</p>
<p>These actions are called <strong>hooks</strong>, and there are several that you can use for various steps along the way to perform additional work within your Git workflow. For example:</p>
<ul>
<li><code>post-receive</code> hooks can be used to perform actions when a commit is pushed to the repository and are useful for CI/CD.</li>
<li><code>post-merge</code> hooks can be used to perform actions after a merge has been completed and are useful for logging and notifications.</li>
<li><code>post-checkout</code> hooks can be used to perform actions after you run <code>git checkout</code> and are useful for setting up project environments.</li>
</ul>
<p>For this tutorial, we will be looking at using the <code>post-receive</code> hook. A common usage for the hook is running some form of continuous integration or deployment. This might mean running tests or deploying a project. For this example, we will be automatically deploying changes to a static HTML site served by Nginx.</p>
<h2 id="prerequisites">Prerequisites</h2>
<p>Gitea is a lightweight and flexible source code management system that will be used for the examples here, so before beginning this tutorial, you should have the following:</p>
<ul>
<li>An Ubuntu 20.04 server with a non-root user configured with <code>sudo</code> privileges as described in the <a href="https://www.digitalocean.com/community/tutorials/initial-server-setup-with-ubuntu-20-04">Initial server setup for Ubuntu 20.04</a> tutorial.</li>
<li>Docker installed on your server as described by <strong>Steps 1 and 2</strong> of our guide on <a href="https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-20-04">How to Install Docker on Ubuntu 20.04</a>.</li>
<li>Docker Compose installed on your server. Follow <strong>Step 1</strong> of our guide on <a href="https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-compose-on-ubuntu-20-04#step-1-installing-docker-compose">How to Install and Use Docker Compose on Ubuntu 20.04</a>.</li>
<li>A domain name pointed at your server. If you are using a DigitalOcean Droplet, you can accomplish this by following our <a href="https://docs.digitalocean.com/products/networking/dns/">Domains and DNS</a> documentation. This tutorial will use &lt;^&gt;your_domain&lt;^&gt; in examples throughout.</li>
<li>Gitea installed on the server behind Nginx, ready to interact with using Git over SSH as described in <a href="https://www.digitalocean.com/community/tutorials/how-to-install-gitea-on-ubuntu-using-docker">How To Install Gitea on Ubuntu Using Docker</a>.</li>
</ul>
<h2 id="step-1-creating-a-static-html-project-in-gitea">Step 1 — Creating a Static HTML Project in Gitea</h2>
<p>To begin with, you will need a repository set up in Gitea. Create a new repository using the <strong>+</strong> button in the upper right corner of the Gitea page. Name it something memorable such as the domain name that it will be deployed to. Fill out the rest of the new repository information and click <strong>Create Repository</strong>.</p>
<p><a href="TODO.html"><img alt="Creating a new repository" src="TODO" /></a></p>
<p>For this tutorial, you&rsquo;ll be setting up a static site at <code>static.&lt;^&gt;your_domain&lt;^&gt;</code>, but be sure to replace this with your final site&rsquo;s domain. Now, wherever you plan on developing, check out that repository using <code>git clone</code>:</p>
<div class="codehilite"><pre><span></span><code>git clone git@&lt;^&gt;your_domain&lt;^&gt;:&lt;^&gt;username&lt;^&gt;/static.&lt;^&gt;your_domain&lt;^&gt;
</code></pre></div>
<p>Move into that directory using <code>cd</code>:</p>
<div class="codehilite"><pre><span></span><code>cd static.&lt;^&gt;your_domain&lt;^&gt;
</code></pre></div>
<p>Now, create a file named <code>index.html</code> which will be served by Nginx. The following example uses <code>nano</code>. This file will contain a little bit of text that we can view in the browser.</p>
<div class="codehilite"><pre><span></span><code>nano index.html
</code></pre></div>
<p>Within that file, add a snippet of HTML that you will recognize:</p>
<div class="codehilite"><pre><span></span><code>[label index.html]
<span class="p">&lt;</span><span class="nt">html</span><span class="p">&gt;</span>
<span class="p">&lt;</span><span class="nt">head</span><span class="p">&gt;</span>
<span class="p">&lt;</span><span class="nt">title</span><span class="p">&gt;</span>Testing Gitea<span class="p">&lt;/</span><span class="nt">title</span><span class="p">&gt;</span>
<span class="p">&lt;/</span><span class="nt">head</span><span class="p">&gt;</span>
<span class="p">&lt;</span><span class="nt">body</span><span class="p">&gt;</span>
<span class="p">&lt;</span><span class="nt">h1</span><span class="p">&gt;</span>It works!<span class="p">&lt;/</span><span class="nt">h1</span><span class="p">&gt;</span>
<span class="p">&lt;/</span><span class="nt">body</span><span class="p">&gt;</span>
<span class="p">&lt;/</span><span class="nt">html</span><span class="p">&gt;</span>
</code></pre></div>
<p>Save and close the file. If you used <code>nano</code> to edit the file, you can do so by pressing <code>Ctrl + X</code>, <code>Y</code>, and then <code>Enter</code>.</p>
<p>Now, add the file to the git working tree:</p>
<div class="codehilite"><pre><span></span><code>git add index.html
</code></pre></div>
<p>Now that the file is added, commit your changes:</p>
<div class="codehilite"><pre><span></span><code>git commit -m &quot;Added index.html&quot;
</code></pre></div>
<p>Push your changes up to your Gitea repository:</p>
<div class="codehilite"><pre><span></span><code>git push origin main
</code></pre></div>
<p>&lt;$&gt;[note]
<strong>Note:</strong> In this example, we are working on the branch named <strong>main</strong>. Your default branch may be named something else such as <strong>master</strong>. In order to find out the name of your current branch, you can run <code>git branch</code>.
&lt;$&gt;</p>
<h2 id="step-2-creating-a-static-html-site-in-nginx">Step 2 — Creating a Static HTML Site in Nginx</h2>
<p>Now, let&rsquo;s set up Nginx to serve our static site. Create a new file in <code>/etc/nginx/sites-available</code> using your text editor:</p>
<div class="codehilite"><pre><span></span><code>sudo nano /etc/nginx/sites-available/static.&lt;^&gt;your_domain&lt;^&gt;
</code></pre></div>
<p>In this file, enter the following:</p>
<div class="codehilite"><pre><span></span><code><span class="k">[label</span><span class="w"> </span><span class="s">/etc/nginx/sites-available/static.&lt;^&gt;your_domain&lt;^&gt;]</span><span class="w"></span>
<span class="s">server</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w"> </span><span class="kn">server_name</span><span class="w"> </span><span class="s">static.&lt;^&gt;your_domain&lt;^&gt;</span><span class="p">;</span><span class="w"></span>
<span class="w"> </span><span class="kn">listen</span><span class="w"> </span><span class="mi">80</span><span class="p">;</span><span class="w"></span>
<span class="w"> </span><span class="kn">root</span><span class="w"> </span><span class="s">/var/www/static.&lt;^&gt;your_domain&lt;^&gt;</span><span class="p">;</span><span class="w"></span>
<span class="w"> </span><span class="kn">index</span><span class="w"> </span><span class="s">index.html</span><span class="p">;</span><span class="w"></span>
<span class="w"> </span><span class="kn">location</span><span class="w"> </span><span class="s">/</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w"> </span><span class="kn">try_files</span><span class="w"> </span><span class="nv">$uri</span><span class="w"> </span><span class="nv">$uri/</span><span class="w"> </span><span class="p">=</span><span class="mi">404</span><span class="p">;</span><span class="w"></span>
<span class="w"> </span><span class="p">}</span><span class="w"></span>
<span class="w"> </span><span class="kn">location</span><span class="w"> </span><span class="s">/.git</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w"> </span><span class="kn">return</span><span class="w"> </span><span class="mi">404</span><span class="p">;</span><span class="w"></span>
<span class="w"> </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>
<p>This <code>server</code> block instructs Nginx to listen on the standard HTTP port 80 for requests to <code>static.&lt;^&gt;your_domain&lt;^&gt;</code>. When it receives a request, it tries to find a file matching that request in <code>/var/www/static.&lt;^&gt;your_domain&lt;^&gt;</code>. It will first try looking for the file named (for instance, if you visit <code>static.&lt;^&gt;your_domain&lt;^&gt;/shark.jpg</code>, it will try to find <code>/var/www/static.&lt;^&gt;your_domain&lt;^&gt;/shark.jpg</code>). If that does not exist, it will append a <code>/</code> to the end of the file name to serve a directory or the file named <code>index.html</code>. Finally, if none of those work, it will serve a 404 Not Found error.</p>
<p>We also don&rsquo;t want anyone accessing our <code>.git</code> directory, so the next <code>location</code> block instructs Nginx to return a 404 should someone try.</p>
<p>Now, link this file from <code>sites-available</code> to <code>sites-enabled</code>:</p>
<div class="codehilite"><pre><span></span><code>sudo ln -s /etc/nginx/sites-available/static.&lt;^&gt;your_domain&lt;^&gt; /etc/nginx/sites-enabled/static.&lt;^&gt;your_domain&lt;^&gt;
</code></pre></div>
<p>In order to make sure everything looks good, you can test the new configuration:</p>
<div class="codehilite"><pre><span></span><code>sudo nginx -t
</code></pre></div>
<p>If all has gone well, you should see something like the following:</p>
<div class="codehilite"><pre><span></span><code><span class="k">[secondary_label Output]</span><span class="w"></span>
<span class="na">nginx: the configuration file /etc/nginx/nginx.conf syntax is ok</span><span class="w"></span>
<span class="na">nginx: configuration file /etc/nginx/nginx.conf test is successful</span><span class="w"></span>
</code></pre></div>
<p>Restarting the server will make these changes live.</p>
<div class="codehilite"><pre><span></span><code>sudo systemctl restart nginx
</code></pre></div>
<p>We need to create the repository for there to be anything to serve, however. Move to <code>/var/www</code> where you can create the directory for hosting the site:</p>
<div class="codehilite"><pre><span></span><code><span class="n">cd</span><span class="w"> </span><span class="o">/</span><span class="k">var</span><span class="o">/</span><span class="n">www</span><span class="w"></span>
</code></pre></div>
<p>Make the directory you specified in your server block above:</p>
<div class="codehilite"><pre><span></span><code>sudo mkdir static.&lt;^&gt;your_domain&lt;^&gt;
</code></pre></div>
<p>You will need to change the permissions on this directory so that both you and the <code>git</code> user have write access.</p>
<div class="codehilite"><pre><span></span><code>sudo chown &lt;^&gt;username&lt;^&gt;:git static.&lt;^&gt;your_domain&lt;^&gt;
sudo chmod g+x static.&lt;^&gt;your_domain&lt;^&gt;
</code></pre></div>
<p>Move to that directory:</p>
<div class="codehilite"><pre><span></span><code>cd static.&lt;^&gt;your_domain&lt;^&gt;
</code></pre></div>
<p>Now that you have the directory set up, you can clone the repository into it. Rather than using SSH, which would require a key, you can use the <code>file://</code> protocol for Git. This works because Nginx is running on the same server that the repository lives on. If the repository is public, you can also use the <code>https://</code> protocol.</p>
<div class="codehilite"><pre><span></span><code>git clone file:///&lt;^&gt;path_to_gitea_installation&lt;^&gt;/repositories/sammy/static.&lt;^&gt;your_domain&lt;^&gt;.git .
</code></pre></div>
<p>It&rsquo;s important to remember to add that <code>.</code> at the end of the <code>git clone</code> command, as this tells Git to check out the repository into the current directory rather than making a new one. Now, if you type <code>ls</code>, you should see the file <code>index.html</code> from your repository, and if you visit the domain you set up, you should see your page rendered.</p>
<p><a href="TODO.html"><img alt="The static webpage" src="TODO" /></a></p>
<h2 id="step-3-using-git-hooks-to-publish-changes">Step 3 — Using Git Hooks to Publish Changes</h2>
<p>Now that Nginx is serving the site from our checked out repository, we can set up the <code>post-receive</code> hook to update the site.</p>
<h3 id="creating-the-hook-script">Creating the Hook Script</h3>
<p>Git hooks for Gitea live in the repository that Gitea serves from. These are located in the data directory, predictably within the <code>repositories</code> subdirectory. Move to your data directory using <code>cd</code>, then move to your repository&rsquo;s <code>hooks</code> directory:</p>
<div class="codehilite"><pre><span></span><code>cd git/repositories/&lt;^&gt;username&lt;^&gt;/static.&lt;^&gt;your_domain&lt;^&gt;.git/hooks
</code></pre></div>
<p>If you list the files in this directory, you will see a whole host of sample scripts, plus a few directories:</p>
<div class="codehilite"><pre><span></span><code><span class="k">[secondary_label Output]</span><span class="w"></span>
<span class="na">total 92</span><span class="w"></span>
<span class="na">drwxr-xr-x 6 git git 4096 Jun 27 17:29 ./</span><span class="w"></span>
<span class="na">drwxr-xr-x 7 git git 4096 Jun 27 17:43 ../</span><span class="w"></span>
<span class="na">-rwxr-xr-x 1 git git 478 Jun 27 17:29 applypatch-msg.sample*</span><span class="w"></span>
<span class="na">-rwxr-xr-x 1 git git 896 Jun 27 17:29 commit-msg.sample*</span><span class="w"></span>
<span class="na">-rwxr-xr-x 1 git git 376 Jun 27 17:29 post-receive*</span><span class="w"></span>
<span class="na">drwxr-xr-x 2 git git 4096 Jun 27 17:29 post-receive.d/</span><span class="w"></span>
<span class="na">-rwxr-xr-x 1 git git 189 Jun 27 17:29 post-update.sample*</span><span class="w"></span>
<span class="na">-rwxr-xr-x 1 git git 424 Jun 27 17:29 pre-applypatch.sample*</span><span class="w"></span>
<span class="na">-rwxr-xr-x 1 git git 1643 Jun 27 17:29 pre-commit.sample*</span><span class="w"></span>
<span class="na">-rwxr-xr-x 1 git git 416 Jun 27 17:29 pre-merge-commit.sample*</span><span class="w"></span>
<span class="na">-rwxr-xr-x 1 git git 1374 Jun 27 17:29 pre-push.sample*</span><span class="w"></span>
<span class="na">-rwxr-xr-x 1 git git 4898 Jun 27 17:29 pre-rebase.sample*</span><span class="w"></span>
<span class="na">-rwxr-xr-x 1 git git 376 Jun 27 17:29 pre-receive*</span><span class="w"></span>
<span class="na">drwxr-xr-x 2 git git 4096 Jun 27 17:29 pre-receive.d/</span><span class="w"></span>
<span class="na">-rwxr-xr-x 1 git git 544 Jun 27 17:29 pre-receive.sample*</span><span class="w"></span>
<span class="na">-rwxr-xr-x 1 git git 1492 Jun 27 17:29 prepare-commit-msg.sample*</span><span class="w"></span>
<span class="na">-rwxr-xr-x 1 git git 134 Jun 27 17:29 proc-receive*</span><span class="w"></span>
<span class="na">drwxr-xr-x 2 git git 4096 Jun 27 17:29 proc-receive.d/</span><span class="w"></span>
<span class="na">-rwxr-xr-x 1 git git 2783 Jun 27 17:29 push-to-checkout.sample*</span><span class="w"></span>
<span class="na">-rwxr-xr-x 1 git git 356 Jun 27 17:29 update*</span><span class="w"></span>
<span class="na">drwxr-xr-x 2 git git 4096 Jun 27 17:29 update.d/</span><span class="w"></span>
<span class="na">-rwxr-xr-x 1 git git 3650 Jun 27 17:29 update.sample*</span><span class="w"></span>
</code></pre></div>
<p>For our purposes, we will be creating a new script within the <code>post-receive.d</code> directory. On Linux, configuration and scripts are usually stored in a directory such as <code>/etc/apt</code> or our <code>hooks</code> directory. However, if there are multiple configuration files or scripts, they may be divided up and placed in a <code>*.d</code> directory, and the service which uses them will read all of those files in list order.</p>
<p>Open a new file in <code>post-receive.d</code> for editing named <code>deploy</code>:</p>
<div class="codehilite"><pre><span></span><code>nano post-receive.d/deploy
</code></pre></div>
<p>This file can be any executable script. In our case, since we&rsquo;ll just be running a simple <code>git</code> command, we&rsquo;ll use a Bash script. Enter the following into that file:</p>
<div class="codehilite"><pre><span></span><code><span class="o">[</span>label post-receive.d/deploy<span class="o">]</span>
<span class="c1">#!/bin/bash</span>
<span class="nb">set</span> -eux
git --git-dir<span class="o">=</span>/var/www/static.&lt;^&gt;your_domain&lt;^&gt;/.git --work-tree<span class="o">=</span>/var/www/static.&lt;^&gt;your_domain&lt;^&gt;/ pull --ff-only
</code></pre></div>
<p>Let&rsquo;s break this script down into its parts to understand what&rsquo;s happening:</p>
<ul>
<li><code>#!/bin/bash</code> tells the shell to use the bash command to run the script.</li>
<li><code>set -eux</code> specifies three options: <code>e</code> means that the script will exit on a failure, <code>u</code> means that unset variables will be an error, and <code>x</code> means that it will print the commands as it executes them. These options are good practice for preventing scripts from continuing to execute when there are errors.</li>
<li>The <code>git</code> command breaks down into <code>git pull</code> which pulls new changes from the repository, while the <code>--work-tree</code> and <code>--git-dir</code> options tell Git to use the <code>.git</code> directory within the checked out branch for all of its configuration. <code>--ff-only</code> instructs <code>git pull</code> to use fast-forward reconciliation when pulling new commits.</li>
</ul>
<p>Once you&rsquo;re done editing the script and have saved and closed it, use <code>chmod</code> to make the script executable:</p>
<div class="codehilite"><pre><span></span><code>chmod a+x post-receive.d/deploy
</code></pre></div>
<h3 id="for-gitea-running-in-docker">For Gitea Running in Docker</h3>
<p>If Gitea is running in a Docker container &mdash; if, for instance, you deployed it using the Docker Compose method in the tutorial linked above &mdash; you will need to make a few changes to make the repository accessible from within the container. First, edit the <code>docker-compose.yml</code> file and move to the <code>volumes:</code> entry. Add a new line to that list:</p>
<div class="codehilite"><pre><span></span><code><span class="p p-Indicator">[</span><span class="nv">label docker-compose.yml</span><span class="p p-Indicator">]</span><span class="w"></span>
<span class="w"> </span><span class="nt">volumes</span><span class="p">:</span><span class="w"></span>
<span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">...</span><span class="w"></span>
<span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">&lt;^&gt;- /var/www/static.&lt;^&gt;your_domain&lt;^&gt;:/var/www/static.&lt;^&gt;your_domain&lt;^&gt;&lt;^&gt;</span><span class="w"></span>
</code></pre></div>
<p>This will mount that directory as a volume that the container can access. You will need to restart your Gitea containers:</p>
<div class="codehilite"><pre><span></span><code>docker-compose down
docker-compose up
</code></pre></div>
<p>Next, you will need to change the remote URL for the repository to the proper location for within the Docker container.</p>
<div class="codehilite"><pre><span></span><code>git remote set-url origin file:///data/git/repositories/sammy/static.&lt;^&gt;your_domain&lt;^&gt;.git
</code></pre></div>
<p>Here, we&rsquo;ve changed the original URL we used to check out the branch from <code>/&lt;^&gt;path_to_gitea_installation&lt;^&gt;/repositories/sammy/static.&lt;^&gt;your_domain&lt;^&gt;.git</code> to use <code>/data/git/</code> as the path to the installation, as that is how the volume is mapped in <code>docker-compose.yml</code>. As always, be sure to use the username and repository name appropriate to your project.</p>
<h3 id="testing-the-post-receive-hook">Testing the <code>post-receive</code> Hook</h3>
<p>Now, after Gitea receives a new commit and it&rsquo;s written to disk, it will run this script to update the branch checked out in <code>/var/www/static.&lt;^&gt;your_domain&lt;^&gt;</code>. To test this out, change the <code>index.html</code> file on your local working directory to include a congratulations message. For example, change the file so that it resembles this:</p>
<div class="codehilite"><pre><span></span><code>[label index.html]
<span class="p">&lt;</span><span class="nt">html</span><span class="p">&gt;</span>
<span class="p">&lt;</span><span class="nt">head</span><span class="p">&gt;</span>
<span class="p">&lt;</span><span class="nt">title</span><span class="p">&gt;</span>Testing Gitea<span class="p">&lt;/</span><span class="nt">title</span><span class="p">&gt;</span>
<span class="p">&lt;/</span><span class="nt">head</span><span class="p">&gt;</span>
<span class="p">&lt;</span><span class="nt">body</span><span class="p">&gt;</span>
<span class="p">&lt;</span><span class="nt">h1</span><span class="p">&gt;</span>It works!<span class="p">&lt;/</span><span class="nt">h1</span><span class="p">&gt;</span>
<span class="p">&lt;</span><span class="nt">p</span><span class="p">&gt;</span>Congratulations on setting up a <span class="p">&lt;</span><span class="nt">code</span><span class="p">&gt;</span>post-receive<span class="p">&lt;/</span><span class="nt">code</span><span class="p">&gt;</span> hook!
<span class="p">&lt;/</span><span class="nt">body</span><span class="p">&gt;</span>
<span class="p">&lt;/</span><span class="nt">html</span><span class="p">&gt;</span>
</code></pre></div>
<p>After saving and exiting the file, commit your changes:</p>
<div class="codehilite"><pre><span></span><code>git commit -am &quot;Added congratulations message&quot;
</code></pre></div>
<p>And push your changes:</p>
<div class="codehilite"><pre><span></span><code>git push origin main
</code></pre></div>
<p>This time, you should see some additional output from Git. Because you set the <code>-x</code> option in our deploy script, you&rsquo;ll see the output of that script during the process, prefixed with <code>remote:</code>.</p>
<div class="codehilite"><pre><span></span><code><span class="k">[secondary_label Output]</span><span class="w"></span>
<span class="na">Enumerating objects: 5, done.</span><span class="w"></span>
<span class="na">Counting objects: 100% (5/5), done.</span><span class="w"></span>
<span class="na">Delta compression using up to 8 threads</span><span class="w"></span>
<span class="na">Compressing objects: 100% (2/2), done.</span><span class="w"></span>
<span class="na">Writing objects: 100% (3/3), 312 bytes | 312.00 KiB/s, done.</span><span class="w"></span>
<span class="na">Total 3 (delta 1), reused 0 (delta 0), pack-reused 0</span><span class="w"></span>
<span class="na">remote: + cd /var/www/static.&lt;^&gt;your_domain&lt;^&gt;</span><span class="w"></span>
<span class="na">remote: + git --git-dir</span><span class="o">=</span><span class="s">/var/www/static.&lt;^&gt;your_domain&lt;^&gt;/.git pull --ff-only</span><span class="w"></span>
<span class="na">remote: From file:///data/git/repositories/&lt;^&gt;username&lt;^&gt;/static.&lt;^&gt;your_domain&lt;^&gt;</span><span class="w"></span>
<span class="na">remote: 28c52bf..95cde6f main -&gt; origin/main</span><span class="w"></span>
<span class="na">remote: Updating 28c52bf..95cde6f</span><span class="w"></span>
<span class="na">remote: Fast-forward</span><span class="w"></span>
<span class="na">remote: . Processing 1 references</span><span class="w"></span>
<span class="na">remote: Processed 1 references in total</span><span class="w"></span>
<span class="na">To &lt;^&gt;your_domain&lt;^&gt;:&lt;^&gt;username&lt;^&gt;/static.&lt;^&gt;your_domain&lt;^&gt;.git</span><span class="w"></span>
<span class="w"> </span><span class="na">8eed10f..95cde6f main -&gt; main</span><span class="w"></span>
</code></pre></div>
<p>When you visit your page in the browser, you should see your now congratulations message displayed.</p>
<h2 id="conclusion">Conclusion</h2>
<p>In this tutorial, you learned how to use Git hooks in Gitea. While you used the <code>post-receive</code> hook to deploy a static website, there are many available hooks that can help you accomplish a wide variety of tasks during your Git workflow. For more information on these hooks, the Git manual has <a href="https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks">an in-depth chapter</a> on using them.</p>
</article>
<footer>
<p>Page generated on 2023-05-10</p>
</footer>
</main>
<script type="text/javascript">
document.querySelectorAll('.tag').forEach(tag => {
let text = tag.innerText;
tag.innerText = '';
tag.innerHTML = `<a href="/tags.html#${text}">${text}</a>`;
});
</script>
</body>
</html>