1
0
flewkey.com/posts/2020-08-28-regarding-git-hosting.md

47 lines
2.5 KiB
Markdown
Raw Normal View History

2020-08-27 20:05:14 -04:00
template: post
title: Regarding git hosting
author: flewkey
2020-08-27 20:08:42 -04:00
timestamp: 1598573216
2020-08-27 20:05:14 -04:00
license: CC-BY
When it comes to online services, many people look past simple solutions and
jump to the large pieces of software and complicated solutions. One case of this
2021-06-05 01:06:05 -04:00
which I see on a regular basis is git hosting, and I dont think that most
2020-08-27 20:05:14 -04:00
people understand how simple it is to host git repositories.
2021-06-05 01:06:05 -04:00
Many people think that hosting git is hard because they believe that its
2020-08-27 20:05:14 -04:00
necessary to install and configure a code forge on their server. They will
usually install GitLab, which is
2021-06-05 01:06:05 -04:00
[“robust”](https://docs.gitlab.com/ee/administration/operations/unicorn.html#unicorn-worker-killer)
2020-08-27 20:05:14 -04:00
and definitely not overkill for hosting a handful of personal repositories.
There are also a few people who install less <del>gross</del> <ins>robust</ins>
git services like [Gitea](https://gitea.io/) and [SourceHut](https://sr.ht/)
2021-06-05 01:06:05 -04:00
to host their projects. The thing is... they really dont have to.
2020-08-27 20:05:14 -04:00
`git clone --bare repo repo.git && scp -r repo.git name@server:/srv/git`
Those are the only commands needed to run to host a git repository on any server
2021-06-05 01:06:05 -04:00
with SSH access. The path doesnt even have to be `/srv/git`. As long as the
2020-08-27 20:05:14 -04:00
URI (e.g. `ssh://name@server:/srv/git/repo.git`) points to a bare git repository
which the user has read access to, they can pull from it. With write access,
they can even push to it. Amazing.
For more information on using git with your server, read the
[relevant chapter](https://git-scm.com/book/en/v2/Git-on-the-Server-The-Protocols)
2021-06-05 01:06:05 -04:00
from the Pro Git book. It will explain how to set up a more limited “git” user for
2020-08-27 20:05:14 -04:00
SSH, use the git daemon, rig up git-http-backend on your webserver, and even use
2021-06-05 01:06:05 -04:00
GitWeb to show a web UI. Its not much harder the simple setup above.
2020-08-27 20:05:14 -04:00
2021-06-05 01:06:05 -04:00
There are also other projects which can complement git hosting. If GitWeb isnt
2020-08-27 20:05:14 -04:00
fancy enough, there is also [cgit](https://git.zx2c4.com/cgit/). Issue tracking
can be handled with [Trac](https://trac.edgewall.org/), and
[e-mail](https://git-send-email.io/) can be used to accept patches. At that
point though, using a proper code forge might be a more suitable option.
2021-06-05 01:06:05 -04:00
Self-hosting git really isnt _that_ important, nor is there anything wrong with
sticking all of ones projects on GitHub. (Most of mine are on the SDF GIT
Society anyways.) However, Ive seen too many people purchase subscriptions from
GitHub for the privilege of private repositories. Im tired of seeing unused
2020-08-27 20:05:14 -04:00
GitLab and Gitea instances as well. When setting up a code forge, make sure
2021-06-05 01:06:05 -04:00
that its necessary.