3.5 KiB
| title | date | description | categories | tags | |||
|---|---|---|---|---|---|---|---|
| Gitea_Install | 2023-02-23T22:32:14-08:00 | Web Development - Git Server |
|
|
If you haven't heard of Git 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. 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 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.
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 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.
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. 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 [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/. 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.
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. 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.