Add ssh support to gitea

This commit is contained in:
2025-11-29 19:49:50 +01:00
parent 1cc8ae103e
commit e1e2040deb
2 changed files with 28 additions and 2 deletions

View File

@@ -3,6 +3,10 @@
services.gitea = { services.gitea = {
enable = true; enable = true;
appName = "Git Server"; # A name for your Gitea instance appName = "Git Server"; # A name for your Gitea instance
user = "git";
group = "git";
settings = { settings = {
server = { server = {
PROTOCOL = "http"; # Use http for now, caddy will handle https PROTOCOL = "http"; # Use http for now, caddy will handle https
@@ -10,7 +14,10 @@
ROOT_URL = "https://git.jelles.net/"; ROOT_URL = "https://git.jelles.net/";
HTTP_ADDR = "127.0.0.1"; HTTP_ADDR = "127.0.0.1";
HTTP_PORT = 3001; HTTP_PORT = 3001;
DISABLE_SSH = true; # Disable the built-in SSH server, use HTTPS for cloning
START_SSH_SERVER = false;
DISABLE_SSH = false; # Disable the built-in SSH server, use HTTPS for cloning
SSH_PORT = 22;
}; };
service = { service = {
@@ -20,4 +27,20 @@
}; };
services.caddy.virtualHosts."git.jelles.net".extraConfig = "reverse_proxy :3001"; services.caddy.virtualHosts."git.jelles.net".extraConfig = "reverse_proxy :3001";
users.users.git = {
isSystemUser = true;
description = "Gitea Service User";
home = config.services.gitea.stateDir;
createHome = true;
homeMode = "750";
useDefaultShell = true;
group = "git";
};
users.groups.git = { };
systemd.tmpfiles.rules = [
"Z /var/lib/gitea 0750 git git - -"
];
} }

View File

@@ -10,7 +10,10 @@ in
settings = { settings = {
PermitRootLogin = "no"; PermitRootLogin = "no";
PasswordAuthentication = false; PasswordAuthentication = false;
AllowUsers = [ username ]; AllowUsers = [
username
"git"
];
}; };
}; };