and it is working but when I clone over HTTPS I have to enter my username/password to push anything and cloning with SSH does not work. When using SSH to clone it just never starts (I have a valid key and it is loaded in ssh-agent).
then configure accordingly via services.forgejo.settings.
SSH keys have nothing to do with user passwords. Unless forgejo has some way of handling this, you’d need to configure users.users.${config.services.forgejo.user}.openssh.authorizedKeys.keys the same way as you did for your own user. EDIT: seems that forgejo can list out the authorized keys via admin regenerate keys, which the nixos module already handles. Then of course make sure to provide the correct username to any ssh or git commands that involve ssh. Still, strange that you’re not getting any error even, I’ll have to check on my end…
Also, the AcceptEnv stuff is redundant, the module already sets that up:
Though I’m not surprised the wiki is just suggesting unnecessary stuff.
It does have a way of handling this, you’re supposed to add your ssh key to the authorized users via its UI.
I don’t know what happens if you use the services.openssh settings to do that, for me it just works™ via the UI.
You can try ssh-ing into the forgejo user and adding -vvv to your ssh command; though I’m pretty sure you’ve just not configured your ssh key for forgejo (or you’ve set up openssh to ignore ~/.ssh/authorized_keys or such).
Well the user should definitely be forgejo.
Also, can you check the contents of /mnt/DATA/Git/.ssh/authorized_keys and see if your ssh public key is listed there?
EDIT2: None of the open ports on your machine seem to be for ssh, are you sure you didn’t close the firewall for ssh? (services.openssh.openFirewall=true). Maybe some fail2ban service is locking you out yourself?
That’s inconvenient (maybe forgejo only suggests the ssh url when you use their built-in server?) but ultimately not a problem, as ssh will still work if correctly configured.
Unlikely, I also encountered the hanging before I added the entry to ~/.ssh/config, and I don’t use fail2ban or anything like it. But as @TLATER said, adding -vvv to the ssh commands will clear up what’s happening.