From 7ab77e5b9051384ad4f5e7e0b235b526330a7163 Mon Sep 17 00:00:00 2001 From: Xavi Date: Sat, 25 Feb 2023 11:57:38 -0800 Subject: [PATCH] Added gitea install post --- .../content/web_development/gitea_install.md | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 xavishobbies/content/web_development/gitea_install.md diff --git a/xavishobbies/content/web_development/gitea_install.md b/xavishobbies/content/web_development/gitea_install.md new file mode 100644 index 0000000..55066b8 --- /dev/null +++ b/xavishobbies/content/web_development/gitea_install.md @@ -0,0 +1,36 @@ +--- +title: "Gitea_Install" +date: 2023-02-23T22:32:14-08:00 +description: Web Development - Git Server +categories: ["Top_of_the_Stack"] +tags: ["web development", "git server"] +--- + +If you haven't heard of [Git](https://git-scm.com/) it's a pretty **[at this point]** universal versioning control system **[basically it makes sure it keeps backups of everything when you accidentally break everything and want to reset it]**. The short version of it is that you can use *git* locally, but a more common method is to push the *repository* **[fancy way to say folder]** to a remote server. Then, you can work on multiple systems **[or save yourself when you accidentally delete the local copy]** by using the remote server as a place to *push* and *pull* changes. + +The most common website **[at least I think it is]** to host *repositories* is [Github.](https://github.com/) *Github* is a great service that is probably a perfect solution for most people. But we aren't most people. Aside from the benefit of learning a system like git from a server-side perspective, hosting our own instance allows for complete control of content, look, visibility of repos, and... well everything. + +It's actually fairly simple to set up a [git server](https://git-scm.com/book/en/v2/Git-on-the-Server-Setting-Up-the-Server) if you aren't looking for a fancy *GUI* and are willing to work from the *terminal*. I have no fear of the terminal but I do think it would be easier to share my code with others by having a frontend that is easy to browse through. However, my frontend development skills need a bit of work **[maybe you can tell from this website]**. Luckily, there is a pretty OOTB **[Out of the box]** solution with [Gitea](https://gitea.io/en-us/). + +*Gitea* is pretty simple to install, although it looks like it isn't in the *Debian* repos so some extra steps had to be taken. The Gitea gitlab has some good [documentation](https://gitlab.com/packaging/gitea) on getting it going. Run **[if you are also using a debian system as your server]** these commands to get Gitea running locally on your server. + +``` code_block +sudo curl -sL -o /etc/apt/trusted.gpg.d/morph027-gitea.asc https://packaging.gitlab.io/gitea/gpg.key` + +echo "deb https://packaging.gitlab.io/gitea gitea main" | sudo tee /etc/apt/sources.list.d/morph027-gitea.list` + +sudo apt-get update && sudo apt-get install gitea morph027-keyring` + +systemctl enable --now gitea + +``` + +You can check that its working by going to [http://localhost:3000.](http://localhost:3000) And that's pretty much it **[hey! that was easy]** to get it running locally **[we aren't done. liar.]**. Now we have to mess with our nginx server to set up a [reverse proxy](https://www.hostinger.com/tutorials/how-to-set-up-nginx-reverse-proxy/) **[that sounds complicated]**. Luckily that's also not to bad to do **[oh]**. All that needs to be done is to add a couple lines to the nginx.conf of your website. In my case I would like my *Gitea* instance to be hosted at [https://xavishobbies.org/git/.](https://xavishobbies.org/git/) So I would add a new location at */git/* and define `proxy pass` to where *Gitea* is hosted locally. The enitre change would look somthing like this. + +```C + location /git/ { + proxy_pass http://localhost:3000/; + } +``` + +Then restart the nginx server and you should be able to reach *Gitea* and get started hosting your own *repositories*. Poke around my [instance.](https://xavishobbies.org/git) I changed my css to match the theme of this website a bit more but all the other options are pretty much left at default.